Graphics, Figures & TablesPlot with months and years as x-axis

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Murd
Posts: 5
Joined: Wed Aug 29, 2018 3:44 pm

Plot with months and years as x-axis

Post by Murd »

Hey!

I'm currently trying to create a plot with pfgplots, that displays the price of fuel since 2005 to today. The data I have provides a data point for each month. My goal is to achieve a plot where every month is abbreviated to the first letter and then grouped by year (see image).
Untitled.png
Untitled.png (19.69 KiB) Viewed 2764 times
Does anyone know how to achieve this? I tried different approaches, but none of them brought me even close.

Thanks!
Murd

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Plot with months and years as x-axis

Post by rais »

Perhaps a groupplot with the year as group's x-label and the months as x-ticks would do.

When I think about how much the price for fuel changes at some gas stations even within one day, one month seems oddly far spaced ;-)

In which form do you have the data? csv file? How does a sample entry look like?

KR
Rainer
Post Reply