Skip to content
Advertisement

How to plot a Rainfall & Waterflow chart in Python?

I’m trying to plot a rainfall & water flow chart as below:

enter image description here

JavaScript

Generate Sample Data

JavaScript

Plotting

JavaScript

I’m able to plot the top part, not sure how to invert or mirror the line chart. How to plot a Rainfall & Waterflow chart as above?

Advertisement

Answer

In order to create the second plot you have to use a subplot:

JavaScript

For the second axis, you can invert y axis with:

JavaScript

Moreover, since x axis is a datetime format, I suggest you to customize it with:

JavaScript

Complete Code

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement