How to create rich more understandable 3D graph with matplotlib

Hi All,

M trying to create a 3D graph to show utilization on the basis of memory, time and day,
Have also created some, but one thing have observed graph is bit difficult to understand and also not able to get right view.

Sample Chart 3D-
Have remove title for some reasons-



Sample Chart 2D

So my question is-

  1. what type of thought process or intuition we should have to create proper and ease to interpret charts
  2. what can be done to improve above chart, so that a normal layman can read and understand

Please share some insights :slight_smile:


Hi @vinodgchandaliya.

My first question would be, do you really need 3D? I would personally think about facetting/subplots first and try to find a 2D solution. In my opinion 3D almost never works (exception is when your plotting scans of bones or have interactivity). This being said, without knowing the underlying data it is hard to recommend something. Nonetheless, using one of the ‘more user-friendly’ Python plotting libraries might make facetting a whole lot easier, if you take this approach.



Thank you for taking my query into consideration, :star_struck: :slightly_smiling_face:

Really need 3D, I m not sure, i was looking for showing 3 dimensional data, like have shown above, utilization by week and utilization by hour,
when have created 2 D graph, it has shown Hour and utilization relationship, which shown a nice pattern
but this graph was lacking utilization pattern same on each day of the month

So, to come out from this situation, have created 3D plot, which shows week hour and utilization, but here things got complex,
All dots were rich to see but hard to interpret
if we see in 2nd 3D graph, there is gap of a particular day where green dots are less,
that shows utilization is not even for all days in a month,

About Data-

this data is about Memory utilization of every 5 minutes for 1 month of a computer
which have tried to plot on chart to see utilization pattern
this pattern will help to take decision,

that’s all, I have,

Let know if have further query on this, :slight_smile:



I played around a bit. Quick and dirty, but this is what I would do for the scenario you described.

I just used some random data, but I assume the idea is clear.


import pandas as pd
import numpy as np
# Plotting library I normally use
import plotnine as gg

gg.options.figure_size = (6, 18)

# Create some data
date_series = pd.date_range('2020-01-06', periods=24*28, freq='H')
mem_load = np.random.normal(loc=50, scale=20, size=24*28)
df = pd.DataFrame({'dates': date_series, 'load': mem_load})

# Assign weeks and names of the day
df['weeks'] = df['dates'].dt.week
df['days'] = df['dates'].dt.day_name()

# Get days for labels
order_days = list(df['days'].unique())

# Plot
(gg.ggplot(df, gg.aes(x='dates', y='load', group='weeks'))
    + gg.geom_line()
    + gg.facet_wrap('weeks', scales='free_x', ncol=1)
    + gg.scale_x_datetime(date_breaks='1 day', labels=order_days)
    + gg.labs(title='Load by week and days',
    + gg.theme(subplots_adjust={'hspace': 0.40},


Hi @vinodgchandaliya

Did you try an heatmap ? This is a 2d plot but it includes a third variable. Easy to interpret.

@htw thank you for graph, this I have tried, in this hour identification is bit difficult, though it has also given a idea of merging heart bit lines with bar graph
Thank You :slight_smile:

@Wilfried, thank you so much for giving your time,
I haven’t thought of heatmap, will try that and see what outcome it shows,
:slight_smile: :innocent:

1 Like