-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Bokeh, transform all colors to hex #956
Comments
@OriolAbril can I try fixing it? |
@mrinalnilotpal Definitely! |
can anybody tell me which files I should look at in order to solve the issue? |
I think you would need to create a function that transforms certain colors (rgb, 'C{i}' syntax etc to hex) These are for bokeh plots |
matplotlib have some functions for color conversion. https://matplotlib.org/api/colors_api.html#functions and the "CN" colors can be accessed from |
Is this issue still to be resolved? |
@mrinalnilotpal @animesh-007 @sahajsk21 It is still pending. Just to make sure it is clear what this PR entails, I'll try to extend the description. The goal is to have some easy way to convert all kinds of colors used by matplotlib (such as It looks like |
Thanks @OriolAbril I'll be working to solve this issue |
@OriolAbril I think this issue has been inactive for a while. Could I work on it? |
@sahajsk21 do you still plan to work on this? |
@amukh18 @OriolAbril I have been working on issue so he can take up the issue.Thanks |
Could there be a typo so the message is this? @sahajsk21 There is no rush, work at your own pace, this is why we ask :). Sorry if my previous wording sounded harsh, it wasn't the intention. Also, please let us know if you were to need any help |
@OriolAbril No it wasn't a typo. Don't worry, I didn't take the comment in the negative sense. Actually, I have been going through the code and making myself familiar first before working on the issue. That is why it is taking so long.
|
@sahajsk21 @OriolAbril Thank you. I'll begin working on it right away. |
@OriolAbril I have a question. If I were to add the to_hex function to plot_khat as follows:
Is this supposed to return any errors? |
I think this should work for this case |
Hmm, pytest returned some errors. I will see what the unit tests on the pipeline say on committing. |
There is now a converter function available (added by #1084), however, is is not used in all plots yet. I am reopening the issue as a remainder to use the converter in all plots |
EDIT: I updated the setting of defaults in #1241 to reduce these lines below: arviz/arviz/plots/backends/bokeh/hdiplot.py Lines 24 to 32 in 4fbd1e2
To a single line when setting the defaults in Plenty (if not all) functions could also take advantage of this which will give both matplotlib and bokeh plots the same style and colors 🎨 |
@OriolAbril would like to work on this. Thanks |
I have assigned it to you. I have to confess I have not followed this for a while so I don't really know which plots use this and which don't, you'll have to first check where it's needed and then make the changes. |
@OriolAbril Is this issue still open? |
If so, I would like to be assigned the task. Pending your reply, I am getting acquainted with the codebase. |
@OriolAbril Upon cloning and reviewing the code, it seems as if the refactoring needed has been done by @Rishabh261998. |
import itertools
import matplotlib.pyplot as plt
def process_color(color, plot_kwargs):
"""Process color input and set line color in plot_kwargs."""
if color[0] == "C":
# Use color cycle from matplotlib
color_cycle = itertools.cycle(plt.rcParams["axes.prop_cycle"].by_key()["color"])
line_color = next(itertools.islice(color_cycle, int(color[1:]), None))
else:
line_color = color
plot_kwargs.setdefault("line_color", line_color) Alternative updated code for the commit above arviz/arviz/plots/backends/bokeh/hdiplot.py Lines 24 to 32 in 4fbd1e2
|
Is this issue still open? |
It should have been closed already @jasochen7, closing now. |
Input all colors to bokeh functions as hex.
We can use matplotlib helper functions to transform special syntax
etc
The text was updated successfully, but these errors were encountered: