Adding secondary X axis to scatter plot

1,957 views
Skip to first unread message

twmit...@gmail.com

unread,
Jan 6, 2014, 7:56:50 AM1/6/14
to spreadsheet...@googlegroups.com
I have not been able to display the secondary X axis to my scatter plot. I wanted to place the second series on X2 with a log-10 based scale. I can do this with Y2, but not X2.
I have included my code. Any suggestions would be appreciated.

regards,
Todd

foreach my $DataSet (keys %group) {
    $row=0;
    foreach my $line ( @{ $group{ $DataSet } }) {
        $worksheet->write_row( $row++, $col, $line );
        print "$row,$col,$line\n";
    }

    my $chart = $workbook->add_chart( type => 'scatter', embedded => 0, subtype  => 'straight_with_markers');   
    $col = $col + 4;

    # TLP I and V
    $chart->add_series(
         name       => xl_range_formula('TLP', 8, 8, $C2, $C2 ),
         categories => ['TLP', 21, 199, $C2, $C2 ],
         values     => ['TLP', 21, 199, $C1, $C1 ],
         line       => { color => 'blue' },       
    );

    # TLP I leak
    $chart->add_series(
                 name       =>xl_range_formula ('TLP', 9, 9, $C2, $C2 ),       
         categories =>['TLP', 21, 199, $C3, $C3 ],
         values     =>['TLP', 21, 199, $C1, $C1 ],
         x2_axis => 1,
         line       => { color => 'red' },         
    );

# Add a chart title.
$chart->set_title( name => "$DataSet",name_font => {
            name  => 'Calibri',
            size => 16 }  );
$chart->set_x2_axis( name => 'current', log_base => 10, visible => 1, min =>1E-12 ,max => 1E-5,);

jmcnamara

unread,
Jan 6, 2014, 9:31:17 AM1/6/14
to spreadsheet...@googlegroups.com

On Monday, 6 January 2014 12:56:50 UTC, twmit...@gmail.com wrote:
I have not been able to display the secondary X axis to my scatter plot. I wanted to place the second series on X2 with a log-10 based scale. I can do this with Y2, but not X2.
I have included my code. Any suggestions would be appreciated.


Hi Todd,

Does Excel allow you to set a secondary X axis? I don't think it does.

John

twmit...@gmail.com

unread,
Jan 6, 2014, 10:38:19 AM1/6/14
to spreadsheet...@googlegroups.com
Hello John,
  Currently I see two datasets on the scatter plot and can manual create secondary X axis through Excel setting the data series to secondary axis. This creates a secondary Y-axis and yet another Excel click needed to add the secondary X axis, thus it's not easy within Excel.

thanks,
Todd

jmcnamara

unread,
Jan 24, 2014, 11:37:53 AM1/24/14
to spreadsheet...@googlegroups.com


On Monday, 6 January 2014 15:38:19 UTC, twmit...@gmail.com wrote:
Hello John,
  Currently I see two datasets on the scatter plot and can manual create secondary X axis through Excel setting the data series to secondary axis. This creates a secondary Y-axis and yet another Excel click needed to add the secondary X axis, thus it's not easy within Excel.

Hi Todd,

I wasn't actually aware of that feature. Excel manages to keep it hidden away. So as you might guess it isn't supported.

Sorry,

John
Reply all
Reply to author
Forward
0 new messages