Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to draw tick marks #328

Open
felixjung opened this issue Jun 19, 2014 · 6 comments
Open

Provide a way to draw tick marks #328

felixjung opened this issue Jun 19, 2014 · 6 comments

Comments

@felixjung
Copy link

I like the ggplot approach taken by Gadfly. However, I dearly miss the ability to draw tick marks on my axes. For my publication purposes, I am required to not show grid lines and instead draw tick marks on the axes. Is there a specific reason they are missing at the moment?

@dcjones
Copy link
Collaborator

dcjones commented Jun 21, 2014

It's definitely something that should be added. I like the default look without ticks, but there should be an option add them.

@dcjones dcjones added the easy label Jun 21, 2014
@felixjung
Copy link
Author

I'd actually be interest in having a look at implementing some of the features I am missing myself. However, I find it kind of hard to navigate the Gadfly codebase... Where do things like drawing gridlines, drawing the legend etc. happen? It shouldn't be hard to draw ticks if a certain theme variable is set. It also shouldn't be hard to not draw the legend, if a certain variable is set.

@dcjones
Copy link
Collaborator

dcjones commented Jun 23, 2014

It's definitely not easy to navigate. Grid lines, labels, keys, etc, are all considered guides. They're defined in src/guide.jl. The guide that drawn gridlines and their labels is XTick and YTick. The function responsible for drawing them is called render. I think you're idea of having an option in theme that turns on tick marks on the margin is a good plan.

The render function for guides return arrays of PositionedGuides, which contain the guide graphic along with an indication of where it should be placed relative to the plot (top, right, over, under, etc). The code drawing the gridlines and tick labels is a little tricky because it's also drawing gridlines that initially hidden and get revealed while panning or zooming, but I think for ticks you can mimic how the gridlines are drawn and just set them to be positioned below or to the left of the plot with under_guide_position and left_guide_position.

Let me know if you get stuck on anything.

@felixjung
Copy link
Author

Cool, I have a look. I have also noticed that the gridlines are somehow drawn above the panel's border. Thus, when setting panel_stroke to a dark color, the border will be interrupted by the gridlines. I think it should be the other way around.

Thanks for the hints.

@dcjones
Copy link
Collaborator

dcjones commented Jun 23, 2014

I agree that the grid lines should be under the border. The issue is that the border is drawn by just stroking the background rectangle in a different color, and the background of course under the grid lines, so I should add a separate border rectangle that's above everything.

@rtambone
Copy link

rtambone commented Jul 6, 2021

Hi all, I just started working with Julia. I would need ticks marks without grid lines and up to date it seems this was not implemented. Any of you can help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants