Python Seaborn: How to add mean into boxplot visualization? - python-3.x

I was able to visualize my data in a boxplot using Seaborn.
sns.boxplot( x=df['Score'].astype('float'), y=df['Group'] )
The visualization shows me: all four quartiles, lower and upper whisker, and some outliers. How can I also add the Mean line into the boxplots? See current visualization (without mean).
Thanks!

I just figured it out. The code works like this:
sns.boxplot(x=df['Score'].astype('float'), y=df['Group'],showmeans=True )

Related

How to change side of y-axis in histogram?

If I use the hist command without any specifications or options, I get a histogram, where the only y-axis is located on the right side. I searched the web for options to change it to the left side, but all I could find was about a second y-axis or the title of the axis.
If you run this script
sysuse auto, clear
set scheme s1color
hist mpg
hist mpg, ysc(alt)
you should see
The default in which the y axis is on the left.
An alternative in which it is on the right.
These are standard options for graph twoway documented from help hist under two_way_options, in turn under axis_options, axis_scale_options.
All the help you need is included with the Stata version you are using. Googling is inefficient here.

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"

"pixel dimension information" when plotting with image in gnuplot

Using gnuplot v5 patch 6 on windows 10 (wxt terminal)
I have a data file of 2D vectors arranged in six columns (x, y, v_x, v_y, v_mag, rho) that I'm trying to plot as a heatmap of v_mag against x and y. The plot generates fine, but it's always coming up with
"No dimension information for 80000 pixels total. Try 200 x 400"
But I have no idea where to specify this in the terminal.
I realise that I can use pm3d map for this, but this doesn't work without setting dgrid3d and that causes problems with plotting dots on top of the heatmap which I'm also doing. I also don't want to generate a matrix file just for the image plot since I need the vector data for analysis later.
In terms of an example, the plot will generate if I literally just write:
plot 'vectors.dat' using 1:2:5 with image, 'dots.dat' with dots
EDIT: added 'set pm3d' to example code
EDIT: example is now minimal code to produce desired plot
EDIT: example data file can be found here
Any help would be appreciated.
After updating my gnuplot to v5.2, this problem has disappeared.

in Gnuplot, how to set the origin point still using 0 except using costume format like 0x10^0?

I am googling this problem but not sure whether I am using the right key words to describe the problem.
The problem is this:
I want to plot the x-ticks with the format 1.0 x 10^6 and some thing like that, so I use the following code:
set format x "%1.1t {/Symbol \264} 10^{%T}"
And the result is like this:
The code works pretty fine except at origin point, which I want it still keeps 0 there, because you can see that 0x10^0 is still 0.
So is there anything I can do to solve this problem, or any web page or documents help solve this problem?
To be more specific, I want the plot look like this:
Thank you!
With the help of MichaelO. and Christoph, I solved the problem.
In Gnuplot, just using
set xtics add('0.0' 0
can overwrite the original one with the new format of tics.
Here is the reference:
excluding a tic number in scientific format

How do I put tick labels inside of a line graph in Flot

I essentially want to have the tick labels sitting inside the graph in their own column. Similar to how Campaign Monitor graphs are. But I can't find a way to do this. Is it possible?
In current versions of flot, the only thing you can control about the ticks is the contents and the label class (all ticks have the class "tickLabel").
I think with those two abilities, you cannot do what you're looking for.
Check out this flot bug for some code modifications that might get you to what you want: http://code.google.com/p/flot/issues/detail?id=191
How is this question different than this one?
jQuery Flot data/axis labels on top of graph
For that one, someone suggests negative labelMargins

Resources