Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the zero axis #3

Closed
alexchandel opened this issue Aug 26, 2014 · 1 comment
Closed

Show the zero axis #3

alexchandel opened this issue Aug 26, 2014 · 1 comment

Comments

@alexchandel
Copy link

RustGnuplot is unable to display the zero axis on gnuplot. The gnuplot commands are set xzeroaxis and set yzeroaxis, given here.

@SiegeLord
Copy link
Owner

That's done using the set_x_axis method. It doesn't show up in the documentation search due to a Rust bug: rust-lang/rust#11943.

Here's an example:

#![feature(globs)]
extern crate gnuplot;

use gnuplot::*;

fn main()
{
    let mut fg = Figure::new();

    let x = [-1i, 1];
    let y = [-3i, 4];

    fg.axes2d()
    .lines(x.iter(), y.iter(), [Caption("A line"), Color("black")])
    .set_x_axis(true, [])
    .set_y_axis(true, [])
    // Turn off the borders and move the ticks to the axes
    .set_x_ticks(Some((Auto, 0)), [OnAxis(true)], [])
    .set_y_ticks(Some((Auto, 0)), [OnAxis(true)], [])
    .set_border(true, [], []);

    fg.show();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants