The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Creating a plot with primary and secondary axis
Hello All,
I am trying to create a plot that combines the volume in various categories as a bar plot (on the primary axis). I want to superimpose a line chart with the rates, but on the secondary axis. I do not see any option to plot the additional chart on the secondary axis.
Please help if this at all can be done within RM.
Thanks!!
I am trying to create a plot that combines the volume in various categories as a bar plot (on the primary axis). I want to superimpose a line chart with the rates, but on the secondary axis. I do not see any option to plot the additional chart on the secondary axis.
Please help if this at all can be done within RM.
Thanks!!
Tagged:
1
Best Answer
-
varunm1 Member Posts: 1,207 UnicornHello @deepeshj
I am sure what you are asking can be done in RM visualizations. I assume you are looking to get two Y-axis opposite to each other rather than, single y-axis with two (If this is the case @gopala solutions works well) this is what I am thinking based on your question relating to the axis. The left y-axis is primary and the right y-axis is secondary.
This can be done as well, follow the below steps.
1. Add a plot similar to gopala suggestion. And select the relevant X-axis and Y-axis
2. Now you need to add a new y-axis, scroll down and you will find y-axis, expand it. Click on add new y-axis as shown in the left figure and then change the axis style of y2 axis based on right side image, click on axis style and select opposite.
3. Finally, you need to link this y2 to plot 2 as shown below. If you scroll up, you can see plot 2 and option linked Y-axis where you need to change the default y1 to y2 in plot 2.
4. The final plot for titanic training data set with Age in the x-axis, No of siblings on y1 axis (Primary) and Passenger fare on y2 axis (Secondary).
Hope this helps.Regards,
Varun
https://www.varunmandalapu.com/Be Safe. Follow precautions and Maintain Social Distancing
4
Answers
You can use "Add new plot" as shown below, hope it helps.