Line plot is a way to represent a series of data by plotting them on two- or tridimensional area and connecting respective data points with lines.
Questions tagged [line-plot]
391 questions
185
votes
7 answers
How to change line width in ggplot?
Datalink:
the data used
My code:
ccfsisims <- read.csv(file = "F:/Purdue University/RA_Position/PhD_ResearchandDissert/PhD_Draft/GTAP-CGE/GTAP_NewAggDatabase/NewFiles/GTAP_ConsIndex.csv", header=TRUE, sep=",", na.string="NA", dec=".",…

iouraich
- 2,944
- 5
- 29
- 40
142
votes
5 answers
How to place inline labels in a line plot
In Matplotlib, it's not too tough to make a legend (example_legend(), below), but I think it's better style to put labels right on the curves being plotted (as in example_inline(), below). This can be very fiddly, because I have to specify…

Alex Szatmary
- 3,431
- 3
- 21
- 30
62
votes
3 answers
Remove seaborn lineplot legend title
I would like to remove the title from my seaborn lineplot legend. I tried using this answer to no avail:
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
fmri = sns.load_dataset("fmri")
fig, ax = plt.subplots()
g =…

Daniel
- 8,179
- 6
- 31
- 56
41
votes
3 answers
Turn off errorbars in seaborn plots
import seaborn as sns
# sample data
df = sns.load_dataset('titanic')
ax = sns.barplot(data=df, x='class', y='age', hue='survived')
Is there a way to turn off the black error bars?

equanimity
- 2,371
- 3
- 29
- 53
34
votes
1 answer
ggplot() lines transparency
How to change the transparency level of lines in ggplot() diagram (i.e. histogram, line plot, etc.)?
For instance consider the code below:
data <- data.frame(a=rnorm(100), b = rnorm(100,.5,1.2))
data <- melt(data)
colnames(data) <- c("Category",…

Ali
- 9,440
- 12
- 62
- 92
30
votes
3 answers
How do I increase the line thickness for sns.lineplot?
I have a few seaborn lineplots and I can't figure out how to increase the width of my lines.
Here is my code
#graph 1
sns.lineplot(x="date", y="nps", data=df_nps, ax=ax1, label="NPS", color='#0550D0')
sns.lineplot(x="date", y="ema28", data=df_nps,…

erb13020
- 325
- 1
- 4
- 7
29
votes
2 answers
Plotting a horizontal line on multiple subplots in python using pyplot
I am plotting three subplots on the same page. I want to draw a horiZontal line through all the subplots. Following is my code and the resultant graph: (You can notice I can get the horizontal line on one of the plots, but not all)
gs1 =…

Abhinav Kumar
- 1,613
- 5
- 20
- 33
23
votes
4 answers
Avoid plotting missing values on a line plot
I want a line plot to indicate if a piece of data is missing such as:
However, the code below fills the missing data, creating a potentially misleading chart:
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
# load…

Stefan Smirnov
- 695
- 3
- 6
- 18
17
votes
2 answers
Is it possible to lineplot more than 6 columns with seaborn?
Is it possible to plot more than 6 columns using seaborn.lineplot?
When I try to plot it I receive following error message:
These `style` levels are missing dashes: {'LOGAN', 'HB20S', 'GOL'}
It works if I index the dataframe for 6 columns.
Here's…

Rafael
- 181
- 1
- 1
- 6
12
votes
1 answer
Seaborn lineplot logarithmic scale
I'm having a problem with adding a logarithmic X-axis to my plot. I want to show results based on the sample size with methods A, B and C.
My dataframe:
A B C
15 0.733333 0.613333 0.733333
30 0.716667 0.693333 …

István Szabó
- 145
- 1
- 1
- 7
8
votes
2 answers
How to fill area under line plot in seaborn
I want to fill the area under a line plot so it looks as the picture below:
instead of
built on the following .csv file:
01-01-97 1
01-02-97 2
01-03-97 3
...
01-11-17 251
01-12-17 252
01-01-18 253
what should I change in…

Stefan Smirnov
- 695
- 3
- 6
- 18
8
votes
2 answers
Line plot of multiple variables in R
I have input data in below format.
x y z
0 2.2 4.5
5 3.8 6.8
10 4.6 9.3
15 7.6 10.5
How can i plot the xy scatter plot like excel (show below) in R?

Manish
- 3,341
- 15
- 52
- 87
7
votes
4 answers
Can you plot interquartile range as the error band on a seaborn lineplot?
I'm plotting time series data using seaborn lineplot (https://seaborn.pydata.org/generated/seaborn.lineplot.html), and plotting the median instead of mean. Example code:
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
fmri =…

firefly
- 339
- 2
- 10
7
votes
4 answers
How to plot two list in the same graph, with different colors
I need to plot two lists on the same graph. The lines should be of different colors.
I am trying to plot forecast and train_Z on the same graph, but I get them plotted against each other, with forecast on the x-axis, and train_Z on the y-axis.
Here…

Alberto Alvarez
- 805
- 3
- 11
- 20
6
votes
1 answer
Assign color to lines ggplot2
I would like to do a line plot with 5 different line using ggplot2. I used the following code.
plot <- ggplot() +
geom_line(data=MS, aes(x=date, y=MSCI.World.PI, color='MS')) +
geom_line(data=S, aes(x=date, y=SandP.TR, color='S')) +
…

JuliaK
- 129
- 1
- 1
- 9