last day (14 days later) » 

12:54 AM
1
A: Ordering the x-axis in an R graph

eipi10Based on your comments, it looks like (1) labels doesn't correspond to gvs and order, and (2) if I sort the first two columns by order, the data frame will be ordered properly. Please let me know if this is not correct. Sort first two columns by order, leaving third column alone: df[,c("gvs","o...

 
oops, added the link, going to try this out now! thanks
I'm confused on what the output is in this, I work in terminal so I've never been good at visualizing the ggplots
 
Can't you just look at the plot?
 
I'm in terminal so I just see: imgur.com/a/kTO9d. Is there a way to get a .jpg file output?
 
I'd suggest using RStudio, which will make it much easier to see the ouput of your code. For now, see update, which includes code to save the graph.
 
Thanks so much! We are very close! Here is what the file looked like: imgur.com/a/NN0Et. I want the x-axis to be in the order given in the original data.frame thought. The only thing that needs to be ordered by the order column is the gvs along the x-axis. Does that make sense?
 
12:54 AM
Ordering by the order column means that the first value on the x-axis will have order=1 (Adygei), the second value will have order=2 (Balochi), etc. Do you mean you want the label values to be in the same order as in the data you posted (i.e., Adygei, Basque, etc.)? That's fine, but it's different from ordering by order.
 
Yes I want the values in the left column gvs to be ordered by the order column. But the values in the labels column I want to be in the order that they already are in the original data.frame. Sorry for confusion
 
See update. Just don't do the ordering step.
 
Should the graph look exactly the same as before? Here's the new graph: imgur.com/a/1dgDW. I want the gvs plotted along the x-axis in the order described in the order column. I want the labels plotted in the same order they appear in the labels column. Is that what this new graph is? Shouldn't the old plot look the same as the new plot if the gvs were always plotted in the order of order column. The only difference should be the x-axis right?
 
Now I'm really confused. Are you saying you want to break the link between the gvs column and the labels column by sorting them separately? Maybe you should list, say, the first five labels on the x-axis and the first five y-values that should be in the plot (both starting from the left), just to be absolutely clear.
 
First point = (Adygei, -2.33), second point from left = (Basque, -0.85), third point from left (French, -0.93), fourth point from left = (italian, -2.89)
You are amazing!!!!!!!!
My post here has the actual pvalues but I'm going to try and grind through your work to see if I can somehow incorporate it into the graph. Very very very well done, I love you!
4
A: How to scale the dots of a graph based on their p-value in R?

lmoAdding to @zheyuan-li's answer, here is a normalization that puts the size of the points for p-values "equal" to 0 with size 2, and the point size of observations with p-values "equal" to 1 with size zero: plot(df.ordered$gvs, pch = 19, cex=2 * (1-df.ordered$pvals)/(df.ordered$pvals +1), ...

 
1:05 AM
In ggplot, scaling the p-values just requires the range argument to scale_size_continuous (see my answer to your question for the code).
 
I tried your code using a data.frame that looked like this
and my output looked like:
My graph with my own shitty coding looks like:
but I really like your circling of the specific pvalues and the labels for the regions and the pvalues so I'm trying to get yours to work
 
Feel free to add an edit to your question to follow up on issues you're still having. Or, if the issue is something new, just ask a new question.
 
I'm out of my 24 hour questions. Though I want to keep giving you karma..
 
Ha Ha. Thanks!
 
I'm gong to go upvote all your posts
 
1:18 AM
Also, I edited the code in my question to make the mapping from p.value to size a bit cleaner, but it doesn't change how the plot looks.
Please don't upvote all my posts! But feel free to upvote if you run across one that you find useful or if you find that one of my answers was inordinately clever or elegant:)
 
I don't understand how your code isn't working for the data.frame that I posted
 
 
15 hours later…
4:41 PM
Can you be more specific about what isn't working? Do you get an error, unexpected output, etc.?
 

last day (14 days later) »