# 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 Thanks,
vinod

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.

Best
htw

2 Likes

@htw
Thank you for taking my query into consideration,  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,

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, vinod

@vinodgchandaliya

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.

Code:

``````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')

# 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())
order_days.append('Monday')

# Plot
+ 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',
x='Weekdays')
axis_text_x=gg.element_text(rotation=75)))
``````

Best
htw

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 @Wilfried, thank you so much for giving your time,
I haven’t thought of heatmap, will try that and see what outcome it shows,  1 Like