1

I have data for each individual participant from a survey. Each individual has a vector of data for example :

#[a,b,c]
[1,2,5] # 1 participant
...
...
...
[1,3,4]

Instead of having that kind of data, I have the data column wise. Example :

a = [1...1] # has n values equal to participants
b = [2...3] # has n values equal to participants
c = [5...4] # has n values equal to participants

I need to plot this data somehow to represent it clearly as a figure, does anybody have ideas how to plot this all together? I have plotted them individually as bar plots with frequencies, but I would like them to be plotted together as a 3D plot so that all 3 dimension's values can be inferred from the data. I have around 200 participants. Any suggestions are welcome.

2
  • 1
    You can use zip to change between the two formats you describe. zip([1, 2, 5], [1, 3, 4]) becomes [(1, 1), (2, 3), (5, 4)]. Commented Jul 24, 2016 at 16:35
  • @Josh fantastic thanks!! Commented Jul 24, 2016 at 16:57

1 Answer 1

4

Use each list as xaxis, yaxis, and zaxis data. This is especially useful when you know the lists are the same length, and each column represents one object. For example, (a[0], b[0], c[0]) represent a trait of the same object. The a-, b- and c-list objects represent the x-, -y, and z-axis fields, respectively.

If you're trying to do a Scatter plot, for example:

import plotly as plotly
from plotly.graph_objs import *

    # stuff here, i.e. your code

    myScatter = Scatter3D(
    # some graph stuff, like your title:
    # title = 'Random_Plot_Title'
        x = a,
        y = b,
        z = c,
    # some more stuff: Here's what I tend to add
    # mode = 'markers',
    # marker = dict(
    #     color = '#DC6D37'
    # ),
    # name = 'Your_Legend_Name_Here',
    # legendgroup = 'Group_Multiple_Traces_Here',
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.