-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
[FR] Colorbar properties #3174
Comments
It's tricky because Plots development aims to keep keywords few(-ish), in order to keep maintainability. In general all new keywords should preferably be applied across all backends to keep interchangeability of backends. One possibility could be to adapt @rafaqz do you happen to know how many of these attributes are supported natively by e.g. GR? |
I think the colorbar should have the same attributes as an axis. For example just like you have xticks and xscale, the colorbar should be able to support cticks and cscale. I came across this limitation while attempting cscale = :log10 (also tried zscale = :log10) on a heatmap. |
I can see how keeping the keyword scope down would be important! especially given the breadth of use cases Plots.jl has to deal with. If we can use the same set of attributes as @hervasa2 suggests, (maybe with I'm not sure what is possible with GR, the |
So having a new keyword type |
Also I didn't read @hervasa2 comment properly, |
I think that sounds like a good approach. |
Yes colorbar_[keyword] with c[keyword] as an alias would be nice and intuitive. I think a minimal feature in GR (if not all axis attributes can be applied to the colorbar) would be colorbar_ticks, that way the user could manipulate the data behind the scenes and set manual ticks to achieve the desired result. |
There is |
I would also very much welcome the ability of manipulating colorbar properties. Thanks for bringing this up! |
I'm also looking for this functionality. Asked for exactly this in Slack and was directed here |
I think it would be nice to be able to access the frame/border/axes of the colorbar as well, e.g. |
related: #2345 |
If anyone is willing to help out with the development of this, please help out with the testing in the PR |
@rafaqz and others, most of the requested changes have been merged, please let me know your comments. Currently only PyPlot backend supports the new colorbar args:
|
currently no c_*** aliases are made yet, but let's first make sure this works |
Thanks, I'll try to give some feedback in the next few days |
Naturally you'd need to use #master branch before we get a relase |
These work perfectly for me. Although I'm not sure what the allowed values for It would be good to add a few controls for the colorbar border too, like color/width etc. Seems it may be easy to copy your PR now to add some related args :) |
colorbar_scale takes :log10, :log2 and :identity (same as axis). Regarding the border and the color, it is strange that you want to change it even. Right now pyplot has 5% border width of the main plot, and I have no idea what do you wish we could've controlled the color |
Oh right yep scale works well too. With color/width - there are situations where you don't want a border on the colorbar, or you want it to be less prominent. For example, if you use e.g. But I can add this later. |
Thank you for working on this! |
Right, I've been aware of this for a while. |
Right now this is a pyplot issue right? I just want to make sure that simplest behavior is still functional. Please let me know if
|
Thanks for your quick response! Yes this is a pyplot issue only.
In the meantime I will test #3432 |
I think the first order of business would be to get "Can't Plots just provide axis formatters? |
I'm not sure how to handle colorbars with log scale right now. I don't think we should focus on (cgrad=:log) just yet. The problem is that I'm not so sure where Plots assigns marker colors to the points . If someone has an idea do let me know. |
Marker colors are stored in the |
Yes, I'm aware of that, but where does it get assigned? Somewhere in the depths of the pipeline but I could not find where |
Aren't those given from the callsite? Or do you have examples where there is automatic color assignment? |
In case of the colorbar, I think the colors need to be assigned somehow? Perhaps I'm missing something here but I thought marker color gets overriten when a colobar is present |
Its the other way around. You get a colorbar of you got marker_z values. How should Plots now what values to put there? |
need testing and feedback from you |
Thanks for the work on this! Is there any progress especially on the log scale colorbar? What is stopping us from merging #3620? |
Lack of testing and user feedback |
That PR is outdated I believe, given a large demand I could revise it. |
Hmm, I don't know if I myself can be representative for a large demand... But for certain the lack of smooth support of log scale colormap/colorbar is one of the reasons I would still prefer matplotlib in production work. I don't feel urgent on this feature since we do have other alternatives, but it's good to have one and maybe I can help test the features and give feedbacks. |
The reason I'm hesitant to merge it is that the colors did not look right to me sometimes. Dangerous decision to plot something that is not representing the actual data. Need to test this thoroughly. My personal workaround is just to log the data preemptively. |
I actually have a use case where taking the log on the data cannot work: a x = rand(1000)
y = rand(1000)
w = 10 .^(10 .* rand(1000))
histogram2d(x, y, nbins=20, weights = w) In this case I really need a log scale colorbar. |
Sorry I thought I had already tested the new functionality and it was merged? What was added with the second PR that was different to before? A description for the PR would help with feedback. |
The second PR actually fixes logscale colors |
First time the color reflected in the colorbar was not matching the data |
any plan to propagate the log colorbar support to other backends? |
Has there been any updates in adding these functionalities to the |
It would be useful to be able to style additional attributes of colorbars, as discussed recently on slack in plotting
- [ ] tick size- [ ] tick colorMy use-case is cleaner map-plotting recipes in GeoData.jl. Currently, if you stray too far from the defaults the colorbar starts to look out of place.
This could start with just GR?
related, but just for ticks: #2308
The text was updated successfully, but these errors were encountered: