How to change the color of bar in shap.plot.bar and shap.plots.waterfalls? - python-3.x

As mentioned in the question, is there anyway we can change color of bar and waterfall plot in shap plot? I didn't see any option to change it. I tried using matplotlib to change the color but that didn't solve the issue. I can add the title but can't change the color. Any help would be great.
plt.title("This is my title")
plt.gray()
shap.plots.bar(shap_values,show = False)
shap.plots.waterfall(shap_values[-1])
plt.show()
Thanks,
Sam

I had a similar issue. I wanted to swap the blue color with the red one in the shap waterfall plot.
My approach was modifying the file _waterfall.py in the shap lib, replacing the lines with c = colors.red_rgb with c = colors.blue_rgb and vice-versa.
Surely not an elegant solution but I just needed to generate 6 plots this way.

Related

Holoviews points plot: NaN color setup

How do I set up the color for NaN in holoviews.points? Especially given that I am sampling the dataset with .where. Applying clipping colors gives the following error:
Unexpected option 'clipping_colors' for Overlay type across all extensions. No similar options found. It is not a background color either.
The code to generate my plot (bear in mind it is an xarray Dataset):
ds_30_365.beta.sel(pc=1).where(ds_30_365.pval.sel(pc=1)<0.2).hvplot.points(c='beta',coastline = True, cmap ='RdBu_r',clim=(-0.025,0.025)).opts(width=600,padding=(0,0))
The whole thing is an example of stippling and ideally I'd like to see ocean part being grey and the land remaining white. There is no data in the land part but everything ends up grey.
Thank you!

Plot coloured region X axis in PyQtgrpah

I need to plot a graph in PyQt5 with PyQtgraph with custom plot like this in QtChart:
enter image description here
Linkt to the cutom QtChart example: https://doc.qt.io/qt-5/qtcharts-customchart-example.html#running-the-example
I think in QtChart/C++ is pretty clear how to do it in the link above. But I haven't found anything in the documentation to do this in pyqtgraph.
Could anyone give me a hint in a documentation or simple example, please? Or maybe can't do this in pyqtgraph.
Thanks a lot.

Italicize and color legend manually for different graphs using same labels and colors

I am trying to create multiple graphs that share the same legend.
I have found many ways to combine multiple graphs and it seems that ggarrange has the ability to create one shared legend for all that is supposed to be unique.
However I am having some problems when graphing since a few of the graphs do not have the same phyla (what defines the legend colors) present, but I would like them all to be the same colors throughout all of the graphs so the combined legend will have the correct colors.
For just one graph I would assign a color to the label manually like below
labs<-c("Arthropoda"="#FF66CC"
,"Cercozoa"="#FF6000")
and plot with the addition of scale_fill_manual(values=labs) and this seems to work
then I modified it so I could have portions of them italicized.
labsPhylum <-c('expression(paste(italic("Arthropoda")))'="#CC0000"
,'expression(paste(italic("Cercozoa")))'= "#FF6000"
,'expression (paste("unknown", ~italic("Eukaryota")))'= "#990000")`
However when I create a plot using ggplot and scale_color_manual() using the labsPhylum that I think should be italicized and colored I plot an empty graph with this warning so there is something vital I am not understanding here.
ggplot(data=sigtab_dil, aes(x=Species, y=log2FoldChange, color=Phylum))+
geom_point(size=2) +
scale_color_manual(values=labsPhylum)
Warning message:
Removed 9 rows containing missing values (geom_point).
Could someone please help me figure out where I am going wrong?
Thank you
Answered my own question
I realized I had to make separate vectors for breaks, labels, and values rather than combining them.
In short
colsPhylum <-c("Arthropoda"="#CC0000"
,"Cercozoa"= "#FF6000"
,"Chlorophyta"= "#CC9900"
labsPhylum <-c(expression(paste(italic("Arthropoda")))
,expression(paste(italic("Cercozoa")))
,expression(paste(italic("Chlorophyta ")))
breaksPhylum <-c("Arthropoda", "Cercozoa","Chlorophyta", "Choanozoa"
,"Ciliophora"
,"Cryptista"

gmtset BASEMAP_FRAME_RGB transparency

I want to not have my basemap axes visible for an image I'm making in GMT with several plots in it. So far I have made them white using:
gmtset BASEMAP_FRAME_RGB = white
However some of the plots partially overlap and the white axes can be seen over the plots - any ideas on how to fix this? By making the basemap frame transparent ideally.
In fact I've realised I can change the order I do the plots in so that the overlap doesn't matter - also replaced -B... with -G255 to plot on a blank square.

Setting labels for rowstacked histgram bars

anybody able to tell me how to add labels to gnuplot rowstacked histogram? I want to add a label to one specific read column.
Data looks like this:
Date, Online_Percent, Offline_percent, Maintance_percent
01.01.2013, 96.000, 2.000, 2,000
i would like to add another column with "offline_time" and label the bar with it (on top or right into the bar, i don't care about that)
Hope anybody can help me.
Thanks
Thanks for trying to help me, but found a solution on an asian site.
Solution :
'' using 0:($2+50):3 with labels notitle
#Explanation:
0=x-index
($2+50)=y-index
3=Value from data to be used as label....
You are also able to apply the style settings like this:
'' using 0:(\$2-10):2 with labels notitle "'font "1" rotate by -90'
Hope it will help others having this question.

Resources