bar-chart

Change color graphic bar

老子叫甜甜 提交于 2021-02-05 09:28:16
问题 I have two datasets of data printed on the same graph. What I want is to differentiate the information by putting a legend that indicates the color of each of the two pieces of information in the graph. I have not been able to put a different color to each information and also a legend that shows what data each color belongs to. My code: . . . %grafica de barras 1 bar(app.CasosUIAxes,data1.dateRep,data1.cases,'r') %grafica de barras 2 bar(app.CasosUIAxes,data2.dateRep,data2.cases)

Detect when matplotlib tick labels overlap

冷暖自知 提交于 2021-02-05 07:09:22
问题 I have a matplotlib bar chart generated by pandas, like this: index = ["Label 1", "Label 2", "Lorem ipsum dolor sit amet", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ac vehicula leo, vitae sodales orci."] df = pd.DataFrame([1, 2, 3, 4], columns=["Value"], index=index) df.plot(kind="bar", rot=0) As you can see, with 0 rotation, the xtick labels overlap. How can I detect when two labels overlap, and rotate just those two labels to 90 degrees? 回答1: There is no easy way to

Detect when matplotlib tick labels overlap

。_饼干妹妹 提交于 2021-02-05 07:08:30
问题 I have a matplotlib bar chart generated by pandas, like this: index = ["Label 1", "Label 2", "Lorem ipsum dolor sit amet", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ac vehicula leo, vitae sodales orci."] df = pd.DataFrame([1, 2, 3, 4], columns=["Value"], index=index) df.plot(kind="bar", rot=0) As you can see, with 0 rotation, the xtick labels overlap. How can I detect when two labels overlap, and rotate just those two labels to 90 degrees? 回答1: There is no easy way to

Detect when matplotlib tick labels overlap

一世执手 提交于 2021-02-05 07:06:30
问题 I have a matplotlib bar chart generated by pandas, like this: index = ["Label 1", "Label 2", "Lorem ipsum dolor sit amet", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ac vehicula leo, vitae sodales orci."] df = pd.DataFrame([1, 2, 3, 4], columns=["Value"], index=index) df.plot(kind="bar", rot=0) As you can see, with 0 rotation, the xtick labels overlap. How can I detect when two labels overlap, and rotate just those two labels to 90 degrees? 回答1: There is no easy way to

Weird lines appearing in the R graph

我的梦境 提交于 2021-02-05 04:59:37
问题 Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs. I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters. I print my graphs in R and then copied them "as metafile" to produce high quality graphs. When i attach these graphs in R they

Weird lines appearing in the R graph

这一生的挚爱 提交于 2021-02-05 04:59:32
问题 Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs. I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters. I print my graphs in R and then copied them "as metafile" to produce high quality graphs. When i attach these graphs in R they

Weird lines appearing in the R graph

ε祈祈猫儿з 提交于 2021-02-05 04:59:22
问题 Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs. I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters. I print my graphs in R and then copied them "as metafile" to produce high quality graphs. When i attach these graphs in R they

R: Barplot height must be a vector or matrix [duplicate]

荒凉一梦 提交于 2021-02-04 21:19:30
问题 This question already has answers here : Create barplot from data.frame (2 answers) How to create barplot from dataframe (1 answer) Closed 3 years ago . I'm trying to make a barplot with grouped bar, but I have this error: 'height' must be a vector or a matrix And I don't know why. My code is ... rebDef=sample(50:100,14,replace=F) rebOf=sample(20:40, 14, replace=F) rebTot=sample(70:140, 14, replace=F) data=data.frame(rebDef,rebOf,rebTot) v <- c("Equipo A", "Equipo B", "Equipo C", "Equipo D",

error bars at the limits in matplotlib barchart

大城市里の小女人 提交于 2021-02-04 20:58:18
问题 I'm trying to get the errorbars to show at the confidence interval's limits, and not in the center. What I want is this: but what I'm getting is this: To plot the bar chart I used this: import pandas as pd import numpy as np import matplotlib.pyplot as plt np.random.seed(12345) df = pd.DataFrame([np.random.normal(32000,200000,3650), np.random.normal(43000,100000,3650), np.random.normal(43500,140000,3650), np.random.normal(48000,70000,3650)], index=[1992,1993,1994,1995]) df1 = df.T df1.columns

error bars at the limits in matplotlib barchart

那年仲夏 提交于 2021-02-04 20:58:10
问题 I'm trying to get the errorbars to show at the confidence interval's limits, and not in the center. What I want is this: but what I'm getting is this: To plot the bar chart I used this: import pandas as pd import numpy as np import matplotlib.pyplot as plt np.random.seed(12345) df = pd.DataFrame([np.random.normal(32000,200000,3650), np.random.normal(43000,100000,3650), np.random.normal(43500,140000,3650), np.random.normal(48000,70000,3650)], index=[1992,1993,1994,1995]) df1 = df.T df1.columns