linegraph

ggplot : Connecting each point within one group on discrete x-axis

让人想犯罪 __ 提交于 2019-12-02 04:54:04
I try to connect jittered points between measurements from two different methods ( measure ) on an x-axis. These measurements are linked to one another by the probands ( a ), that can be separated into two main groups, patients ( pat ) and controls ( ctr ), My df is like that: set.seed(1) a<- rep(paste0("id","_",1:20),each=2) value<- sample(1:10,40,rep=TRUE) measure<- rep(c("a","b"),20) group<- rep(c("pat","ctr"),each=2,10) df<-data.frame(a,value,measure,group) I tried ggplot(df,aes(measure,value,fill=group))+geom_point(position=position_jitterdodge( jitter.width=0.1,jitter.height=.1, dodge

Overlapping axis labels in R [duplicate]

我是研究僧i 提交于 2019-11-30 13:07:25
问题 This question already has answers here : Changing font size and direction of axes text in ggplot2 (6 answers) Closed 6 years ago . I have an issue where I have overlapping axis labels and can't seem to get a solution to fix this. p <- ggplot(data=Data,aes(x=Indicator,y=Numeric,group=Expenditure_group,shape=Expenditure_group,colour=Expenditure_group))+geom_point()+geom_line() Is there a way to fix this so that there are no overlaps? 回答1: You can tune a bit your x axis either by automatically

GGPLOT2: Distance of discrete values of from each end of x-axis

孤人 提交于 2019-11-29 16:33:33
I have been working with the code below. Everything seems to work okay, except that the discrete values on the x-axis are far from each end of the graph. I've tried several things including changing the discrete values and playing with the limits, but can't get it to work. I tested this on simulated data and do not have the same problem, so I guessing it is how I'm processing the data. I'd appreciate any pointers on how to adjust this and/or process the data correctly so it does not occur. The data file being imported is a combination of continuous, discrete and string variables. The data I

matplotlib plot set x_ticks

只愿长相守 提交于 2019-11-29 02:08:16
How would I set the x_axis labels at the indices 1,2,3....n to be something different. lam_beta = [(lam1,beta1),(lam1,beta2),(lam1,beta3),....(lam_n,beta_n)] chunks = [chunk1,chunk2,...chunk_n] ht_values_per_chunk = {chunk1:[val1,val2,...],chunk2:[val1,val2,val3,.....]...} color='rgbycmk' j=0 for chunk in chunks: plt.plot([hr_values_per_chunk[chunk][i] for i,item in enumerate(lam_beta)],[i for i,item in enumerate(lam_beta)],color=j%len(color)) j+=1 plt.set_xticks([i for i,item in enumerate(lam_beta)]) plt.set_xticklabels([item for item in lam_beta],rotation='vertical') plt.show() Error:

GGPLOT2: Distance of discrete values of from each end of x-axis

白昼怎懂夜的黑 提交于 2019-11-28 11:26:19
问题 I have been working with the code below. Everything seems to work okay, except that the discrete values on the x-axis are far from each end of the graph. I've tried several things including changing the discrete values and playing with the limits, but can't get it to work. I tested this on simulated data and do not have the same problem, so I guessing it is how I'm processing the data. I'd appreciate any pointers on how to adjust this and/or process the data correctly so it does not occur.

How to display line graph using JFreeChart in jsp?

两盒软妹~` 提交于 2019-11-28 06:02:16
问题 HI All: I am using the below to diplay the line graph. when i run the below code, i am getting the window but it is blank and not displaying the graph. Please help me and also tell me how to diplay the line graph in html page using below code. import org.jfree.chart.*; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.xy.*; public class xyLine { public static void main(String arg[]) { XYSeries series = new XYSeries("Average Weight"); series.add(20.0, 20.0); series.add(40.0,

How to display highchart series line marker symbol from tooltip formatter?

给你一囗甜甜゛ 提交于 2019-11-27 02:39:06
问题 By default highcharts display the line marker symbol in the tooltip. $(function () { $('#container').highcharts({ xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }, { data: [194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4] }] }); }); http://jsfiddle.net/sashi799/vsyfmu77/ Using tooltip formatter how can we

Plot multiple lines in one graph

寵の児 提交于 2019-11-26 17:38:37
Trying to use ggplot to plot multiple lines into one graph, but not sure how to do so with my dataset. Not sure whether I need to change the datastructure or not (transpose?) Data looks like this: Company 2011 2013 Company1 300 350 Company2 320 430 Company3 310 420 I also tried it transposed: Year Company1 Company2 Company3 2011 300 320 310 2013 350 430 420 And for this I can plot 1 of the values using; ggplot(data=df, aes(x=Year, y=Company1)) + geom_line(colour="red") + geom_point(colour="red", size=4, shape=21, fill="white") But I don't know how to combine all the companies as I don't have

Drawing a simple line graph in Java

只谈情不闲聊 提交于 2019-11-26 13:02:43
In my program I want to draw a simple score line graph. I have a text file and on each line is an integer score, which I read in and want to pass as argument to my graph class. I'm having some trouble implementing the graph class and all the examples I've seen have their methods in the same class as their main, which I won't have. I want to be able to pass my array to the object and generate a graph, but when calling my paint method it is asking me for a Graphics g... This is what I have so far: public class Graph extends JPanel { public void paintGraph (Graphics g){ ArrayList<Integer> scores

Plot multiple lines in one graph

对着背影说爱祢 提交于 2019-11-26 06:37:12
问题 Trying to use ggplot to plot multiple lines into one graph, but not sure how to do so with my dataset. Not sure whether I need to change the datastructure or not (transpose?) Data looks like this: Company 2011 2013 Company1 300 350 Company2 320 430 Company3 310 420 I also tried it transposed: Year Company1 Company2 Company3 2011 300 320 310 2013 350 430 420 And for this I can plot 1 of the values using; ggplot(data=df, aes(x=Year, y=Company1)) + geom_line(colour=\"red\") + geom_point(colour=\