How to modify this Keras example to plot predictions on the same figure and for a longer period?

Hello.

I know this is a forum about Julia but I have a question related with Python and I couldn’t get an answer on other places, and you have always been very helpful and nice.
I’m new to Python and Keras.

I’ve been following the “Timeseries forecasting for weather prediction” code found here:
https://keras.io/examples/timeseries/timeseries_weather_forecasting/

At the end they plot the predictions, but they generate a different plot for each point, only 5.
How can I plot them all in the same one, as if they were continuing the line with past information?

The code to plot is like this (simplified)

# Defines the plot
def show_plot(plot_data, future, title):
    labels = ["History", "True Future", "Model Prediction"]
    marker = [".-", "rx", "go"]
    time_steps = list(range(-past, 0)) # rango negativo para tiempo pasado.

    plt.title(title)
   
    for i, val in enumerate(plot_data):
        if i:  # I think this plot the predicted points
            plt.plot(future, plot_data[i], marker[i], markersize=10, label=labels[i])
        else:
            # this plots the line
            plt.plot(time_steps, plot_data[i].flatten(), marker[i], label=labels[i])
    plt.legend()
    plt.xlim([time_steps[0], (future + 5) * 2])
    plt.xlabel("Time-Step")
    plt.show()
    return

# And this executes de plot.
for x, y in dataset_val.take(5):
    show_plot([x[0][:, 1].numpy(), y[0], model.predict(x)[0]], 12, "Single Step Prediction")
step = 6
past = 720  
future = 72
learning_rate = 0.001
batch_size = 256
epochs = 10

timeseries_weather_forecasting_26_1
timeseries_weather_forecasting_26_3

It seems that the object with the data is like this:

<BatchDataset shapes: ((None, None, 4), (None,)), types: (tf.float64, tf.float64)>

it’s a batch of tuples with (batch_of_sequences, batch_of_targets).

I think that twelve (the future parameter) is wrong, it should be changing its value.

What numbers should I modify to get predictions for a longer period?

future
take(5)
12

Besides the plotting question… I guess in order to properly predict 100 points I would also need to train the model with many more past points too.