can you please help me by telling how to plot line graph in python(python 3.x preferably) using two lists containing string values.
my lists looks like:
y= ['27%', '27%', '27%', '27%', '27%', '27%', '27%']
x= ['18ww25', '18ww27', '18ww28', '18ww28.1', '18ww29', '18ww29.1', '18ww29.2']
moreover, there are multiple such pairs with different y list but same x list. Moreover x list should form markers on the X axis.
Moreover I am extracting these values from an excel file using pandas because of which I am getting values like "18ww28.1" although in excel file it is present as "18ww28"
how to plot a single graph containing all the lines from such pairs by correcting all x list values(for eg from "18ww28.1" to "18ww28") and then plotting.
If 7 pairs are there then the 7 lines should be there in graph and y list values should be plotted in the same format(in percentage)
the table which i want to plot is- excel table
actually, this file originally conatins many tables. I have read the complete file in a pandas data frame then grouped this table then converted this table to csv and then iterated through each row by storing each row value to a list and have also stored 1st row value in a list and want to plot each row list against first row list in such a way-
row1_list=['18ww24','18ww25','18ww34'](for ex)
row2_list=['24%','25%','67%'](for example)
This basically means consumption of some resource is '24%' on '18ww24' thats why I have to plot ('18ww24','24') as a point in graph(same for all the corresponding values of both the list)
then similarily,
row1_list
row3_list
and so on for every row......
Also, 1st row should form markers on X axis against which every entry of other rows are plotted and the plotted line for each row should be on same graph
Related
To be simple, I have a Excel PowerQuery request which download a table from the web.
I'm trying to draw a graph with multiple lines, the horizontal axis is always the dates, and the vertical axis is composed from all the lines.
Here an example of what it look :
My objective is to catch all the data of the table dynamically without having every time to extend the data range by clicking on the graph.
On the data range :
By using =Table_0__6[[#Tout] I get all the table data, but my goal is to catch only the Dates column (horizontal axis) and two other columns of entry for the data series.
I tried many ways.
By example, if the columns were adjacent, the data range could be :
=Table_0__6[[#Tout];[Date]:[Column 2]]
Since the entry columns are not adjacents, I tried to link the data series by ; or + like this : (not working)
=Table_0__6[[#Tout];[Date]:[Column 1]]+Table_0__6[[#Tout];[Date]:[Column 2]]
or even : (not working)
=Table_0__6[[Date];[Column 1]+[Column 2]];
My question is : Do you have any idea on how catching in horizontal axis every data of Date column from the table, and for the veritcal axis every data of column 1 and 2 ?
Have a great end of week
Respectfully
Thanks
I am using scipy.linalg.block_diag function to create a block diagonal matrix from a given dataframe which has same number and label for its rows and columns. While the said function can create a block diagonal matrix from the given input, it is not keeping track of the name of the rows and columns of the matrix. Is there anyway to print the ordered list of rows/columns so that once can make a heatmap seaborn plot with given x and y labels?
Thanks,
I have a 3 column table named 'A' from which I want to plot a heatmap or scatter plot where I can see a colour for the coordinates indicated by the first two columns. For example, at row 'A91552' and column 's_4_AAGCTA' I want to see a colour corresponding to 0.47619.
Example data:
'A91552' 's_4_AAGCTA' 0.476190000000000
'A91554' 's_4_CCTATT' 0.476190000000000
's_4_AAGCTA' 'A91552' 0.476190000000000
's_4_CCTATT' 'A91554' 0.476190000000000
Is there a way to do this directly using the strings as indices, or will I need to make a double matrix and change the axis labels on something like imagesc?
Found it:
I just needed to convert my lists of strings to categorical variables:
scatter(categorical(A.Var1), categorical(A.Var2), 125, A.Var3, 'filled')
Hello and good day to all
I have question related to excel graph. I have some set of values like this
Now I want to plot these values as a scatter graph. I want to to draw in such a way that by keeping X values same and 4 different Y plots i.e. A, B, C, D in a single graph. Meaning I dont want to merge these Y values on a single X value. Is there any way to do that? I thank you for your time and help.
The data does not make much sense. All X values are exactly the same, so all data markers will be at exactly the same X position.
To create a scatter chart with multiple series:
- select the data from A1 to B11
- insert a scatter chart
- select the B, C, D ranges (C1 to E11) and copy
- select the chart and use Paste Special > insert as new series with series name in first row
Since all X values are the same, many data points overlap and are not distinguishable.
Edit after comment: if you do NOT want to plot the values at their true X position (i.e. the value 1.4), then use four pairs of X / Y coordinates. Use X values 1 to 4 with A to D. Then use text boxes to replace the X axis labels or hide the labels and show the legend instead.
I want to create an automated scatter plot. This is the first example table based on the step size I end up measuring A, B, C, D for a specific frequency. In this scatter plot I created manually you can see I want to plot C v/s A for a particular frequency.
But I need to do this automatically as based on the step size the number of row can change. Here, since the step size decreased the number of samples increased, and now the scatter plot needs to update number of A and C values it plots.
Is there a formula I can use without using any macros?
The relation between the step size and frequency is (number of samples of a single frequency = (360/step size)) so for a step size of 60 you will have in reality six entries of frequency 100 and six of 200 .
You can use formulas to define chart ranges if you hide the formulas in named ranges. Combine that with the fact that #N/A values are not plotted and you can get this to work without VBA.
For your example graph you could define two names ranges as follows:
Name: A_100
Refers To: =IF(Sheet1!$E$3:$E$100=100,OFFSET(Sheet1!$A$3,0,0,360/Sheet1!$B$1,1),NA())
and
Name: C_100
Refers To: =IF(Sheet1!$E$3:$E$100=100,OFFSET(Sheet1!$C$3,0,0,360/Sheet1!$B$1,1),NA())
Then set the X and Y axis of the chart to SheetName!A_100 and SheetName!C_100
The if statement filters out all the points not at frequency 100, if you have a formula for selecting the frequency replace "Sheet1!$E$3:$E$100=100" with that.
The offset function takes the first cell in the column and expands the number of rows according to your 360/step size formula.