change violinplot stick color in seaborn - python

Id like to be able to change the color of individual sticks in seaborn's violin plot to highlight a specific datapoint. Any seaborn pros have ideas how to do this?

Related

Labeling bar plot

Could someone, please help me with the labeling bar plot on their above? I created a bar plot and the columns are colored with a different color but because of having a lot of colors, it is very hard to define which color belongs to which column. That is why I thought it is better also label the bar above them to see that which color represents which column. Or if you have a better idea please share it with me. My graph:
The code I used:
df.plot.bar(stacked=True)
plt.legend()
plt.show()

colorbar for subplots matplotlib

I am trying to add colorbar for each subplot. The 3D data is like (x,y,z). My codes are like:
fig,ax = plt.subplots(2,2,figsize=(15,15))
ax[0,0].scatter(x,y,s=z,c=z,cmap='jet')
ax[0,0].set_xlabel('XXX')
ax[0,0].set_ylabel('YYY')
So I am able to add x,y labels, add title for each subplot, but I just can't add the colorbar.
My codes for colorbar in a single plot are like:
plt.colorbar(extend='both')
or
colorbar = plt.colorbar(label='test',orientation='horizontal',shrink=0.8,pad=0.05,extend='both')
I saw the previous Q&A here matplotlib colorbar in each subplot, but sorry I don't understand how to apply to my case. Is there a way to add the colorbar, just like how I added the xlabel and title, please? Many thanks.

How to modify inner style of violin plot in Seaborn Python

I'm plotting violin plot using seaborn.
but the color of mini box inside of each violin is arbitrary; black to gray.
I want to change the color of inner mini box as well as the line color of whisker.
Could you help me out?
Thank you in advance!

How do I use seaborn's lmplot to show a colobar for hue, instead of exact values?

I'm trying to get my seaborn plot to look something like this:
If I use lmplot with the z-axis for the hue, I get this:
The lmplot in the picture is basically what I want, but I need the colorbar on the right side instead of the actual values.
I tried to do this with a heatmap, but the data plot was worse that way due to the large gaps between samples.
Thanks for any help!
You should use plt.scatter. The hue parameter in lmplot only accepts categorical variables.

Having a colorbar for a bar plot in python

Hi I don't know if this is possible, but I have made a bar plot in python where the color is a hex value. If I have the value that a hex code corresponds to, is it possible to make a colorbar for my bar plot in python? Or is there a way to use a colormap for bar plots in python?
This is my image right now. The color corresponds to a value, and I want to add a colorbar that has a range of colors with the value it will be. I have done this for scatter plots but I did not use a color map but just hex values for each bar.
Matplotlib does support colobars. Here's the API:
http://matplotlib.org/api/colorbar_api.html
Here's a code sample of a colorbar associated with a plot:
http://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html
EDIT:
Specifically to a bar plot, you could use a LinearSegmentedColormap instead of a colorbar, as in here

Categories