Plotting irregular values over linear date-axis

Even I have experiences with other program languages - with Python I am a bloody beginner I must say. Nevertheless I would like to use matplotlib.dates to plot the course of measured temperature data over the date, (x-axis). The problem for me: the measurement of the temperatures is not regularly, it could be every day, every second day, every fifth and so on. So I have values which are measured not equidistant in time, but I still want them plotted over a linear date-axis (x-axis), eventually linked with a continuous line.

I worked with several example, modules and date formatters but I couldn’t succeed. Always, I found, it is necessary to have for every equidistant date-point a value, for 100 days 100 values. I have within 100 days 30 value-date couples, not equidistant…

I would be very glad to get some hints or examples I can work with.

Thank you very much for any remark!
Best Bruno

Can you post an example of what you tried? It is very difficult to help you starting ab initio.

It is not clear if you want the spacing on the screen to always be even (ax.plot(range(len(data)), data)) or spaced to represent how far apart in time they are (ax.plot(list_of_date_as_datetime_objects, data)).

Thank you very much for your response!

I experimented (within IDLE) with two examples of matplotlib’s classes “dataFormatters”, the default and the “conciseDataFormatter” (Formatting date ticks using ConciseDateFormatter — Matplotlib 3.5.1 documentation ). Still I think I’d like to start with one of these two programs. Both have the scalable date-x-axis I want, but unfortunately both also have the solid coupling of one (random) value to every timeDelta, which I can’t break up. Concerning my task: let’s say over one year I will have 50 values measured in very different time distances. E.g. 10 values in March, 3 values in August, …

Since I am still learning Python, I didn’t manage to change the examples to distribute less values, assigned to specific days, casually over the continuous date-axis.

Hope it is a bit clearer what I want to do. At first this task seemed trivial to me, but neither Excel nor Numbers can do it without any tricks. So I would be very happy to make it with Python.
Kind regards

Can you please share a code snippet of what you have tried? It is impossible to help you any further based on information we have :disappointed: .

Sorry, here is it

import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy as np

base = datetime.datetime(2021, 11, 5)
dates = [base + datetime.timedelta(days=i) for i in range(365)]
N = len(dates)
y = np.cumsum(np.random.randn(N))    # X*

fig, axs = plt.subplots(2, 1, constrained_layout=True, figsize=(6, 6))
lims = [(np.datetime64('2021-11'), np.datetime64('2022-11')),
        (np.datetime64('2022-02'), np.datetime64('2022-05'))]
for nn, ax in enumerate(axs):
    ax.plot(dates, y)
    # rotate_labels...
    for label in ax.get_xticklabels():
axs[0].set_title('Default Date Formatter')

 X* instead of these continuos random values I'd like to insert
 8 discret value at certain days (later more):
   7.5     5.11.2021
   7.7     29.11.2021
   8.6     16.12.2021
   10      17.2.2022
   12      12.3.2022
   10      4.4.2022
   7.4     11.4.2022
   7.8     20.4.2022