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

ggroc with several aesthetics #42

Closed
Johnzav888 opened this issue Feb 27, 2019 · 3 comments
Closed

ggroc with several aesthetics #42

Johnzav888 opened this issue Feb 27, 2019 · 3 comments

Comments

@Johnzav888
Copy link

Johnzav888 commented Feb 27, 2019

Hi,

I am trying to plot two roc curves in the same figure. I would like to have different colour as well as different linetype for each. However, i can do only one at a time and not simultaneously. That is, i can have different colour but same linetype :

`ggroc(list(myrocglm, myrocrf), legacy.axes = T) + geom_abline(intercept = 0,slope = 1)`  

or different linetype but same color :

`ggroc(list(myrocglm, myrocrf), aes= "linetype", legacy.axes = T) + geom_abline(intercept = 0,slope = 1)` 

And if i try to add the color parameter in the fuction above, it works only for one value, i.e. color="red". For more i get the following error :

"Error: Aesthetics must be either length 1 or the same as the data (353): colour"

Thanks,
John

@xrobin xrobin changed the title ggroc with two curves ggroc with several aesthetics Feb 27, 2019
@xrobin
Copy link
Owner

xrobin commented Feb 27, 2019

Am I understanding it correctly that the problem is not about multiple curves in a single ggroc plot, but about changing multiple aestetics? I edited your question to reflect that, if it's not the case please let me know.

This sounds like a good idea, I will gave it a try.

@Johnzav888
Copy link
Author

Johnzav888 commented Feb 28, 2019

Yes, i guess you are right... It is straightforward to plot many roc curves in the same figure, but my question is merely how to distinguish them. For instance, in a paper it is common that you need different color but also different linetype, in order to be distinguishable also in a black&white paper...

Ps I just tried to change the title in the legend, but it doesn't work...It keeps outputing the title "name" ! See the pic below and the code i tried (myplot is the ggroc object)!

`myplot + guides(fill=guide_legend("my awesome title")) + theme(legend.position="bottom", legend.title = element_text(colour="blue", size=10, face="bold"))` 

image

Thanks!

xrobin added a commit that referenced this issue Mar 3, 2019
xrobin added a commit that referenced this issue Mar 3, 2019
@xrobin
Copy link
Owner

xrobin commented Mar 3, 2019

It should now be possible to pass multiple values to aes with the latest commit on the master branch:

ggroc(list(rocs...), aes= c("linetype", "colour"))

Please let me know if it works for you.

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

2 participants