Search code examples
pythonmatplotlibseaborndata-analysisscatter-plot

Plotting a 3-dimensional graph by increasing the size of the points


Currently I have a plot that look like this.

Photo of my plot (I want to plot this in 3D)

  1. How do I increase the size of each point by the count? In other words, if a certain point has 9 counts, how do I increase it so that it is bigger than another point with only 2 counts?

  2. If you look closely, I think there are overlaps (one point has both grey and orange circles). How do I make it so there's a clear difference?

In case you have no idea what I mean by "Plotting a 3-dimensional graph by increasing the size of the points", this below is what I mean, where the z-axis is the count

enter image description here


Solution

  • This answer doesn't really answer the question straight up, but please consider this multivariate solution seaborn has:

    The syntax is way easier to write than using matplotlib.

    seaborn.jointplot(
        data = data,
        x = x_name,
        y = y_name,
        hue = label_name
    )
    

    And voila! You should get something that looks like this

    enter image description here

    See: https://seaborn.pydata.org/generated/seaborn.jointplot.html