How would I make my boxplot show two columns instead of one - r

I'm trying to make a box plot that will show columns PSS_pre and PSS_post
At the moment I have the following code:
boxplot(PSS_post~intervention)
This code shows the column PSS_post, although I can change PSS_post to PSS_pre and it will show me the column for PSS_pre. How can I make it show me both colums at the same time?

Consider plotting a list with the 2 elements.
pp_list <- list(Pre = PSS_pre~intervention, post=PSS_post~intervention)
boxplot(pp_list)

Related

I need to remove labels with 0 value [LibreOffice Calc]

I am creating a very basic dashboard in libreoffice Calc. Right now I am trying to create some piecharts and bar charts. I am facing similar problem with both this type of charts.
Piecharts: I have ALL the labels to the right of the chart, even if those labels have an actual value of 0. I want labels with 0 value not to be displayed.
Bar charts: Similar to Piecharts, I want the chart not to display those X values with 0.
I am using LibreOffice Calc 6.4.7.2
If anyone can help me.
Just filter the source data table
If you want to see the entire data table, you can put the filtering result in another place and build a diagram based on this trimmed data.

How to break one table row into multiple lines in RMD

summary <- summary(data)
knitr::kable(summary)
I have the following code in RMD. However, there are more than 20 attributes in the dataset, so that the width of the table generated by summary() is too larger to show the entire table in a row in the page.
Just wondering how could I do to adjust the summary() table?
In addition to r2evans answer, maybe there is another way of reducing the table width :
1- In a table : you should consider transposing the columns into lines. The 6 statistics of summary() should be the columns, and the variables (attributes, according to you) should be the line, e.g.,
summary <- t(summary(data)) # just a basic version, for clarity.
2- In a graphic : if you want all of your attributes renders like columns, maybe you should consider some boxplot (or geom_col and geom_errorbar), with facets or by using an x axis-values for each attribute ? With facet_grid() or facet_wrap(), it's more easy to compare a bunch of attributes than in a big table. If your want to compare things, fix the scales between the facets. If necessary, you can use the grid package, in order to define each facet size and aspect...
Excellent day

How to edit legend labels in google spreadsheet plots?

I'm trying to plot some data in Google spreadsheet:
And as you may see all of the series are in a same column and I can't use the any of the rows as headers. My plot looks like this:
I would appreciate if you could help me know how I can edit/add legend labels.
Unfortunately I don't think the graphs were intended for your data format.
The only way I've been able to work out how to add a header is by reformatting my data so I have the header at the top of my ranges.
So I suggest you split your data into separate columns so you have;
D2:D4, E2:E4, F2:F4 etc with D1, E1, and F1 as your header and then selecting "Use row 1 as your headers." From the data menu.
Alternatively, you could add labels to the series themselves. Although not ideal, it could be quicker than reformatting your data. On the data menu, click on the three dots of a data series to bring up a menu that allows you to add a label. Unfortunately this needs to be a cell so you'll have to have that header on your sheet some where.
I had the same question this year (2021), and it looks like there's support for it now. In short, you just have to double-click on the empty legend item for the series, and it'll give you a place to put text, directly in the chart.
Here's what my chart looked like (with no series titles):
If you double-click on one, you'll get a small text input area.
Type in your series name and then press enter or click outside of the input area.
Repeat this for each series, and you should be good to go.
I had the same problem because I was selecting only the data I wanted to include in the chart and not the entire table, headers and all. When you create a chart in Google Sheets and you want to use a row or column (or both) as strings that are included in the chart's labeling, you must select the entire table before choosing the Chart command from the Insert menu.
After doing so, you may need to do all or some of the following:
Switch rows/columns if your axes are not correct
Eliminate any rows/columns that you don't want represented by editing the Data Range field in the chart editor
Select Use column A as headers or Use row 1 as headers
You could also potentially use the add labels option when clicking on the 3 dots in the series section:
Double-click on the symbols in your legend, then double-click on the symbol for the series you would like to label; you should be able to directly enter your legend label now. You can do further text formatting using the chart editor on the right.
I took them to a new sheet. first selected only the X-axis and one of the columns that will appear as one. label. In this sheet, I made all the "labels" as a header of the sheet. and added them one by one as a series. and this time it. add them as a label.
obviously this is a workaround and the bug should be fixed :) hopefully.

Plots of different rows on the same graph

I found an interesting thread about plotting but I'm not happy with the answer. I would like to plot different amount of rows on the same graph. Just giving me the possibility to add as much rows as I want to.
I'd like to use glopts library but I am open for any other. First of all I want to plot those rows into pdf file. The script which I want to modify is:
which_rows <- c(12,156,4432) ## I want to choose which row I want to plot
pdf(file='Plots'.pdf)
x <- 1:(ncol(data_plot)-1) ## Can it be changed to use the name of the columns instead of pure numbers ?
for(i in which_rows){
## create new pdf page BUT I WANT TO PLOT IT ON THE SAME GRAPH!
plot(x=x,y=data_plot[i,-1],type='b',main=data_plot[i,1],xlab='columns',ylab='Intensity')
}
# closing pdf
dev.off()
Can you help me to modify this script to print just all of the rows which I decide on the same graph ? Would be great if you show me how I can jsut add new page in this pdf file using the other set of rows like which_rows2.
Of course each plot should has diffent colour or something.
Edit:
use points()to add points to the existing plot

LocusZoom standalone change x-axis and use the plots in a script

I am using the standalone LocusZoom software,but I am having two problems:
I have to create a plot showing only position on the x-axis (not showing the genes). If I just use showGenes=FALSE with nothing else the genes still appear, but if I use rfrows=0 then the genes are not shown, but the problem is that also the x-axis label with the positions disappears. Is there a way to only show the position label? It looks like the only way to do this is to modify the original script...
Is there a way to use several plots created using LocusZoom in an R script to position many plots into one unique figure? (output is a pdf for now) There is an option listed in the LocusZoom webpage (http://genome.sph.umich.edu/wiki/LocusZoom_Standalone) called "prelude" but I cannot get more info on how to use it.
If you have any suggestions for either of these two issues it would be very helpful! Thanks!!

Resources