I have a solist of 4 point patterns.
I then defined
names(solist)=c("a","b","c","d") as a vector of 4 string elements.
Now when I plot just the solist like plot(solist), I get the customized titles on the plot
I then created a hyperframe as h=hyperframe(experiments=solist)
Now when I plot like plot(h$experiments) , I have lost the names and the plots now have a default 1,2,3,4 as plot titles.
I do not know if this is how it should be or if I miss something. I would like to retain the names of the solist in the hyperframe so that when I plot the hyperframe, I have the same names as the solist.
Please guide.
A hyperframe does not allow the individual entries to have names. There can be row names and column names, but individual entries cannot have names.
If you had done row.names(h) <- c("a","b","c","d") then plot(h$experiments) would have shown these names as the titles of the plot panels.
PS: Avoid using solist as the name of an object. This could conflict with the function solist().
Related
So, I want to keep only 1 red axis line. By default it shows or removes both of them, shows 1 line for each "row".
Don't know how to change my excel to english, sorry.
You need to use some tricks for this. Use an XY Scatter chart and plot the two lines as two series, one for the horizontal line, one for the vertical line.
Then format the axes to the desired maximum and remove all the grid lines.
If you want only specific numbers to show on the axes, remove the axis labels altogether and use data labels for data points instead.
I am trying to count and plot the number of data points I have for each area by day, so far I have:
But I would like to show the number of instances of each county per day, with the end goal of plotting them on a line graph, like:
Only I would want to plot each county on its own line, rather than the total which I have plotted above.
Update:
I have managed to get this from the answers provided:
Which is great and exactly what I was looking for. However, in hindsight, this looks a little messy and not very descriptive even for the short period plotted let alone if I were to plot this for a couple of years worth of data.
So I'm thinking to plot this indivually on an 8 grid plot. But when I try to plot this for one county I am getting the boolean values. As below:
What would be the best way to plot only the True values?
You can try
df.county.groupby([df.date_stamp, df.county]).count().unstack().plot();
df.county...count() is the numerical series you want to plot.
groupby([df.date_stamp, df.county]) groups first by date_stamp, then by country (the order matters).
unstack will create a Dataframe whose index is the time stamp, and columns are counties.
plot(); will plot it (and the ; suppresses the unnecessary output).
Edit
To plot it on separate plots, you could do something like
for county in df.county.unique():
this_county = df[df.county == county]
this_county.county.groupby(df.date_stamp).count().plot();
title(county);
show();
pd.crosstab(df['date_stamp'],df['county']).plot()
EDIT: question changed, if you want them in subplots instead of lines:
pd.crosstab(df['date_stamp'],df['county']).plot(subplots=True)
The key in drawing each county as a separate line is that each county needs to be in a different column. If you just want to count them, crosstab is then probably the shortest way to achieve that result. For example:
Then the result is:
When subplots=True:
My problem is as follows:
The user inputs two numbers between 2 and 25, these numbers are used to create a grid. Every point on the grid has (x,y) coordinates. Based on the amount of points the user chose, my excel sheet is filled up with up to 25x25 (x,y) coordinates.
Example: A 6x7 grid is chosen by the user, the table is filled with 42 (x,y) coordinates and all other values in the table are set to "".
Now I want to use a scatterplot with lines connecting each array to plot the data.
Problem 1: If I only select the 6x7 part of the table that has values in it and create the scatterplot the result is correct. Until the user specifies a different grid, for example 8x9, then the graph is obviously missing two rows and two columns of input data.
Problem 2: If I select the entire 25x25 part of the table, including all the "" values, the graph axes get messed up. The y-axis works properly, but the x-axis shows sequential values (0-7) instead of the x-coordinates.
Problem 3: If I replace all the "" values in the table to 0 or NaN and plot the entire table the axes are correct, but the lines between the scatter data get messed up.
Question:
Is there a way to automatically change the input data for the plot, or is there a way to correctly display the values on the x-axis if I select all the data?
Not sure this will work in your case, but it's worth a try, especially since no one's addressed your post in 3+ hours. I've had success with this approach: 1) charting the largest data set, 2) copying the resulting chart, and 3) trimming the data it draws from to produce all smaller data sets.
To get this to work takes a lot of thought in laying out that largest data set so that all the other plots follow as needed. To illustrate, I've somewhat mimicked your data and in the animated gif I show largest data set, plus 2 others produced by copying it. Then I demonstrate how to make the second one, including the rescaling required to make all plots scaled equally. Notice that I've arranged things so that only one set of x-values feeds all the series. If you can do this, it makes working with the Excel's interface much easier.
After wrestling with it all night I came to the following solution:
Instead of setting all the empty cells to "" or zero the cells should be be set to #N/A (not available). The graph properly ignores the #N/A cells exactly like I want it to and updates when values are entered into them.
How can Newton's basin of attraction be created from a data file?
I got 10000 points in the range -2, 2 and their zeros for complex function z^3-1. I'd like to plot them with three different colors to create basin of convergence.
Data I've obtained from my program is available here. The format is like this:
(-0.422468,1.36075) (-0.5,0.866025)
(1.19376,1.1324) (1,-6.76273e-19)
...
First two numbers in "( )" are complex start points, the second two are the zero that it converges to. Zeros are exact to the level of e-10, I can easily change it to e-16.
From what I understand, I would try something like:
plot 'yourdata.dat' using 1:2:(arg($3+$4*{0,1})) '(%lf,%lf) (%lf,%lf)' palette
The string '(%lf,%lf) (%lf,%lf)' is the format of your data, so that gnuplot can read it as a file of four columns. Then, you can select the columns to be plotted with using 1:2:(arg(...)); in this case, the x-axis is the real part of the starting points (column 1), and the y-axis is its imaginary part (column 2). The third part of using, arg($3+$4*{0,1}), and the option palette are used to chose the color depending on the phase of the complex zero (columns $3 and $4).
I have a data file of the format:
172.168.1.1 12
192.168.1.0 1
.......
They are IP addresses with corresponding connections to them. I want to draw a histogram of connection to each IP address. However, gnuplot consider the column one to be numeric and thus plots a histogram differently. Is there a way to tell gnuplot to consider the column 1 as string labels instead?
I haven't had this problem myself, but this might work:
plot "myfile" using 2:xticlabels(1)
This question can also be relevant for you.