I'm very new to data visualising tools and I faced this problem. I have serveral columns in my Pandas dataset ('A', 'B', 'C', 'D', 'E'). I would like to create plot (scatter plot preferably) on which I can choose columns for axises and dynamically build graph for choosen pairs, without changing the code. For example 'A' and 'D' etc. Is this even possible or I need to change my dataset or Chart object each time before building the plot?
Asked
Active
Viewed 81 times
0
-
What kind of object do you use to store the data? `pandas`, `numpy`, plain `dict`/`list`, ...? – SamProell Jul 05 '19 at 12:27
-
I use pandas. Sorry for missing it. I just corrected my question – Dmitry Sazhnev Jul 05 '19 at 12:30
-
Have a look at this answer: https://stackoverflow.com/a/17813222/10694594 – SamProell Jul 05 '19 at 12:35
-
Possible duplicate of [How to plot two columns of a pandas data frame using points?](https://stackoverflow.com/questions/17812978/how-to-plot-two-columns-of-a-pandas-data-frame-using-points) – SamProell Jul 05 '19 at 12:38
-
@SamProell this question is absolutelly different. I know ho to make two columns plot with points. I want to make it flexible and be able to change columns for plot without changing code – Dmitry Sazhnev Jul 05 '19 at 16:03
-
i am sorry, i am not entirely sure what your goal is, then.. Do you wont something like a GUI with checkboxes? – SamProell Jul 05 '19 at 17:05
-
@SamProell I want my two axises to be choosable, so I can choose any pair of colums ('C' and 'D', for example), and after watching this 'C,D' plot I want to change it to 'B,E' by choosing B and E from a dropdown or something like this, etc. – Dmitry Sazhnev Jul 05 '19 at 17:12
1 Answers
1
I had similar requirement for one of my projects and the way I did it was to modify the input dataFrame. For example consider that the input data set is as Image 1, you can change the data frame to Image 2 below.
Now you could use Altair selection and transform to select the X and Y. Depending on the size of your data this may or may not be feasible, but it can probably solve your problem.
Image 1
Image2

Goli
- 66
- 2
- 5