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

Add arrows at the end of x and y axis #1740

Closed
adamkk opened this issue Sep 5, 2016 · 7 comments
Closed

Add arrows at the end of x and y axis #1740

adamkk opened this issue Sep 5, 2016 · 7 comments
Assignees

Comments

@adamkk
Copy link

@adamkk adamkk commented Sep 5, 2016

Hi,

After long time searching this issue, I need to ask this request. In my academic work, each chart needs to have x and y axis ending in arrows. Example: http://www.policonomics.com/supply-and-demand/

How can I add this to my ggplot2 charts?

Best,

@thomasp85
Copy link
Member

@thomasp85 thomasp85 commented Sep 5, 2016

@hadley what do you think of this? It's rather straightforward to add an arrow argument to element_line() which would make this possible... The grob placements will not be affected by the added width/height from the arrows so it should be a safe change...

@adamkk
Copy link
Author

@adamkk adamkk commented Sep 5, 2016

Dear @hadley,

perhaps line_type in element_line() could be changed from: "An integer or name: 0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = two dash", to 1.... through 7= solidarrow ?

@thomasp85
Copy link
Member

@thomasp85 thomasp85 commented Sep 5, 2016

That would be the wrong approach - the arguments should map directly to polylineGrob so that element_line would gain an arrow argument that would get passed along in element_grob.element_line()

@hadley
Copy link
Member

@hadley hadley commented Sep 5, 2016

My only concern would be that there might be clipping issues — I can't remember where/when the axes are drawn. If that's not a problem, go ahead and add it.

@thomasp85 thomasp85 self-assigned this Sep 6, 2016
@thomasp85
Copy link
Member

@thomasp85 thomasp85 commented Sep 6, 2016

My cursory investigation shows no clipping problems so I'll make a PR

thomasp85 added a commit that referenced this issue Sep 6, 2016
Add arrow argument to element_line(). Fixes #1740
@hadley hadley removed the in progress label Sep 6, 2016
@adamkk
Copy link
Author

@adamkk adamkk commented Oct 31, 2016

Thanks for the arrows. They look great !

Today, I have replicated the chart in RStudio with arrows using theme() and element_line(arrow=arrow()). Yet, while using theme_bw() it did not work. Is the element_line an attribute to one theme only, or all themes can make use of it?

Question: how I can get a clear background on the chart (without gray background and grid)?
See link: http://www.policonomics.com/supply-and-demand/

Best,
Adam

@hadley
Copy link
Member

@hadley hadley commented Oct 31, 2016

@adamkk a better place for questions of that nature is the ggplot2 mailing list

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants