Options

Creating a plot with primary and secondary axis

deepeshjdeepeshj Member Posts: 7 Contributor II
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!!

Best Answer

  • Options
    varunm1varunm1 Moderator, Member Posts: 1,207 Unicorn
    edited September 2019 Solution Accepted
    Hello @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

Answers

  • Options
    arjun_gopalarjun_gopal Member Posts: 7 Contributor II
    Hi Deepesh, 
    You can use "Add new plot" as shown below, hope it helps.



  • Options
    deepeshjdeepeshj Member Posts: 7 Contributor II
    Hi @gopala- I was able to create charts of the type you shared but this wasn't what I was looking for. May be my question wasn't clear. Anyways, thanks!!
  • Options
    deepeshjdeepeshj Member Posts: 7 Contributor II
    Hi @varunm1- This is exactly what I was trying to create. Thanks a lot!!
Sign In or Register to comment.