The base R plot functions commonly use the argument lwd
for specifying the line thickness. These are relative line widths though, and different help files indicate that this is a multiplying factor. So a linewidth lwd = 1
gives a line width of 1 * defaultwidth
.
Where do I specify the default width for the line, or how can I make sure a line is eg specifically 0.75pt, as set in other software like Excel?
Matplotlib allows you to adjust the line width of a graph plot using the linewidth attribute. If you want to make the line width of a graph plot thinner, then you can make linewidth less than 1, such as 0.5 or 0.25.
To set plot line width/thickness in R, call plot() function and along with the data to be plot, pass required thickness/line-width value for the “lwd” parameter.
To increase the thickness of error line in a Matplotlib bar chart, we can use err_kw=dict() with their properties.
The thickness is typically between 0.05 and 0.3.
The default line width is dependent on the device used for the plotting. In order to read this information, you should be aware of the general interpretation of inches, points and pixels. The general rules are:
This can depend however on the settings of your device:
pdf()
and postscript()
devices: lwd = 1
refers to a linewidth of 1/96 inch or 0.75 points.png()
, jpeg()
, tiff()
and bmp()
devices: res
which defines the ppi (points per inch).lwd = 1
is 1/96 of an inch but takes the settings of res
into account. So if res = 96
, lwd = 1
is a thickness of 1pt, but your point is interpreted smaller than a regular point.Also keep in mind that with the bitmap devices, a higher setting of res
will blow up your figure on screen. So in the previous example, a lwd = 1
with a setting of res = 96
gives a line with a thickness of 1pt, but shown on the same screen this will increase the line thickness from 1 pixel to 1.33 pixels. If you scale both figures to be exactly the same size, they look the same (apart from the resolution obviously).
See also:
How do I specify axis thickness in a plot? (in R)
Increasing the thickness of box lines in an R boxplot?
https://graphicdesign.stackexchange.com/questions/199/point-vs-pixel-what-is-the-difference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With