Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit802aaa9

Browse files
committed
merge master into image-backend
2 parents53c8fa5 +a689b6e commit802aaa9

File tree

8 files changed

+31
-8
lines changed

8 files changed

+31
-8
lines changed

‎.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# heavily influenced by https://github.com/PistonDevelopers/piston-examples/blob/a473c4baa1262bbf6916b677f3bdcde2b6d3c1b5/.travis.yml
2+
language:rust
3+
rust:
4+
-stable
5+
-nightly
6+
before_install:
7+
-wget https://www.libsdl.org/release/SDL2-2.0.5.tar.gz -O SDL2-2.0.5.tar.gz
8+
-tar -xzvf SDL2-2.0.5.tar.gz
9+
install:
10+
-(cd SDL2-2.0.5 && ./configure && make && sudo make install)
11+
script:
12+
-cargo build -v
13+
-cargo test --no-run

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#dataplotlib
2+
[![Build Status](https://travis-ci.org/coder543/dataplotlib.svg?branch=master)](https://travis-ci.org/coder543/dataplotlib)
23

34
This is an early-stage plotting library for Rust that tries to make it easy to do scientific plots in Rust.
45

‎examples/coloredxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() {
1717

1818
// Adds the sin plot and the linear plot with custom colors
1919
pb.add_color_xy(xy_sin,[1.0,0.0,0.0,1.0]);
20-
pb.add_color_xy(xy_lin,[0.0,0.0,1.0,1.0]);
20+
pb.add_color_xy(xy_lin,[0.0,0.75,0.0,1.0]);
2121

2222
let sdlh = dataplotlib::sdl2_init();
2323
let sdl2_window =DrawSDL::new(sdlh);

‎src/draw_sdl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use sdl2_mt::Sdl2Mt;
99

1010
use draw::*;
1111

12+
/// Provides an SDL2-based interactive plotting backend
1213
pubstructDrawSDL{
1314
sdlh:Sdl2Mt,
1415
window_id:u32,

‎src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@
2222
//!
2323
//! // Adds the sin plot and the linear plot with custom colors
2424
//! pb.add_color_xy(xy_sin, [1.0, 0.0, 0.0, 1.0]);
25-
//! pb.add_color_xy(xy_lin, [0.0, 0.0, 1.0, 1.0]);
25+
//! pb.add_color_xy(xy_lin, [0.0, 0.75, 0.0, 1.0]);
26+
//!
27+
//! let sdlh = dataplotlib::sdl2_init();
28+
//! let sdl2_window = DrawSDL::new(sdlh);
2629
//!
2730
//! let sdlh = dataplotlib::sdl2_init();
2831
//! let sdl2_window = DrawSDL::new(sdlh);
2932
//!
3033
//! let mut plt = Plotter::new();
3134
//! plt.plot2d(pb, sdl2_window);
35+
//! # plt.disown(); // make sure the doc test doesn't last forever
3236
//! }
3337
//! ```
3438

‎src/plot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ fn get_min(user_min: Option<f64>, values: &Vec<f64>) -> f64 {
4242
fnf32_4_to_color(col:[f32;4]) ->[u8;4]{
4343
[
4444
(col[0]*255f32)asu8,
45-
(col[2]*255f32)asu8,
4645
(col[1]*255f32)asu8,
46+
(col[2]*255f32)asu8,
4747
(col[3]*255f32)asu8,
4848
]
4949
}

‎src/plotbuilder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ pub enum PlotVals2D {
2222
AnimFunColor([f32;4],AnimFn),
2323
}
2424

25-
/// `PlotBuilder2D` contains all of the necessary information to create a
26-
/// series of stacked 2 dimensional plots. For the moment, only provide one
27-
/// `PlotVals2D`, otherwise things will probably go poorly.
25+
/// `PlotBuilder2D` contains all of the necessary information to create a series of stacked 2 dimensional plots.
26+
/// For the moment, only provide one `PlotVals2D`, otherwise things will probably go poorly.
2827
#[derive(Clone)]
2928
pubstructPlotBuilder2D{
3029
/// **pvs** contains the **P**lot **V** alue **s**

‎src/plotter.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ mod test {
5959
usesuper::*;
6060
use plotbuilder::*;
6161
use util::*;
62+
use draw_sdl::DrawSDL;
63+
use sdl2_mt;
6264

6365
#[test]
6466
fnplot2d_test(){
@@ -67,10 +69,13 @@ mod test {
6769
let y =(&x).iter().map(|x| x.sin()).collect();
6870
let xy =zip2(&x,&y);
6971

72+
let sdlh = sdl2_mt::init();
73+
let sdl2_window =DrawSDL::new(sdlh);
74+
7075
letmut pb1 =PlotBuilder2D::new();
7176
pb1.add_simple_xy(xy);
7277
letmut plt =Plotter::new();
73-
plt.plot2d(pb1);
74-
plt.join();
78+
plt.plot2d(pb1, sdl2_window);
79+
plt.disown();
7580
}
7681
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp