Skip to content

Commit cb9f304

Browse files
authored
Move egui_plot to its own repo (#4828)
* Part of https://github.com/emilk/egui/issues/4705 `egui_plot` can now be found at https://github.com/emilk/egui_plot
1 parent 1384410 commit cb9f304

36 files changed

+11
-8196
lines changed

.github/workflows/labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
with:
3030
mode: minimum
3131
count: 1
32-
labels: "CI, dependencies, docs and examples, ecolor, eframe, egui_extras, egui_glow, egui_plot, egui-wgpu, egui-winit, egui, epaint, exclude from changelog, typo"
32+
labels: "CI, dependencies, docs and examples, ecolor, eframe, egui_extras, egui_glow, egui-wgpu, egui-winit, egui, epaint, exclude from changelog, typo"

ARCHITECTURE.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Also see [`CONTRIBUTING.md`](CONTRIBUTING.md) for what to do before opening a PR
55

66

77
## Crate overview
8-
The crates in this repository are: `egui, emath, epaint, egui_extras, egui_plot, egui-winit, egui_glow, egui_demo_lib, egui_demo_app`.
8+
The crates in this repository are: `egui, emath, epaint, egui_extras, egui-winit, egui_glow, egui_demo_lib, egui_demo_app`.
99

1010
### `egui`: The main GUI library.
1111
Example code: `if ui.button("Click me").clicked() { … }`
@@ -24,9 +24,6 @@ Depends on `emath`.
2424
### `egui_extras`
2525
This adds additional features on top of `egui`.
2626

27-
### `egui_plot`
28-
Plotting for `egui`.
29-
3027
### `egui-winit`
3128
This crates provides bindings between [`egui`](https://github.com/emilk/egui) and [winit](https://crates.io/crates/winit).
3229

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# egui changelog
22
All notable changes to the `egui` crate will be documented in this file.
33

4-
NOTE: this is just the changelog for the core `egui` crate. [`eframe`](crates/eframe/CHANGELOG.md), [`egui_plot`](crates/egui_plot/CHANGELOG.md), [`ecolor`](crates/ecolor/CHANGELOG.md), [`epaint`](crates/epaint/CHANGELOG.md), [`egui-winit`](crates/egui-winit/CHANGELOG.md), [`egui_glow`](crates/egui_glow/CHANGELOG.md) and [`egui-wgpu`](crates/egui-wgpu/CHANGELOG.md) have their own changelogs!
4+
NOTE: this is just the changelog for the core `egui` crate. [`eframe`](crates/eframe/CHANGELOG.md), [`ecolor`](crates/ecolor/CHANGELOG.md), [`epaint`](crates/epaint/CHANGELOG.md), [`egui-winit`](crates/egui-winit/CHANGELOG.md), [`egui_glow`](crates/egui_glow/CHANGELOG.md) and [`egui-wgpu`](crates/egui-wgpu/CHANGELOG.md) have their own changelogs!
55

66
This file is updated upon each release.
77
Changes since the last release can be found at <https://github.com/emilk/egui/compare/latest...HEAD> or by running the `scripts/generate_changelog.py` script.

CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/crates/egui_plot @Bromeon @EmbersArc
21
/crates/egui-wgpu @Wumpf

Cargo.lock

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,15 +1059,6 @@ dependencies = [
10591059
"env_logger",
10601060
]
10611061

1062-
[[package]]
1063-
name = "custom_plot_manipulation"
1064-
version = "0.1.0"
1065-
dependencies = [
1066-
"eframe",
1067-
"egui_plot",
1068-
"env_logger",
1069-
]
1070-
10711062
[[package]]
10721063
name = "custom_window_frame"
10731064
version = "0.1.0"
@@ -1302,7 +1293,6 @@ dependencies = [
13021293
"document-features",
13031294
"egui",
13041295
"egui_extras",
1305-
"egui_plot",
13061296
"log",
13071297
"serde",
13081298
"unicode_names2",
@@ -1348,17 +1338,6 @@ dependencies = [
13481338
"winit",
13491339
]
13501340

1351-
[[package]]
1352-
name = "egui_plot"
1353-
version = "0.28.1"
1354-
dependencies = [
1355-
"ahash",
1356-
"document-features",
1357-
"egui",
1358-
"emath",
1359-
"serde",
1360-
]
1361-
13621341
[[package]]
13631342
name = "ehttp"
13641343
version = "0.5.0"
@@ -3288,17 +3267,6 @@ dependencies = [
32883267
"winapi-util",
32893268
]
32903269

3291-
[[package]]
3292-
name = "save_plot"
3293-
version = "0.1.0"
3294-
dependencies = [
3295-
"eframe",
3296-
"egui_plot",
3297-
"env_logger",
3298-
"image",
3299-
"rfd",
3300-
]
3301-
33023270
[[package]]
33033271
name = "scoped-tls"
33043272
version = "1.0.1"

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ members = [
66
"crates/egui_demo_lib",
77
"crates/egui_extras",
88
"crates/egui_glow",
9-
"crates/egui_plot",
109
"crates/egui-wgpu",
1110
"crates/egui-winit",
1211
"crates/egui",
@@ -58,7 +57,6 @@ emath = { version = "0.28.1", path = "crates/emath", default-features = false }
5857
ecolor = { version = "0.28.1", path = "crates/ecolor", default-features = false }
5958
epaint = { version = "0.28.1", path = "crates/epaint", default-features = false }
6059
egui = { version = "0.28.1", path = "crates/egui", default-features = false }
61-
egui_plot = { version = "0.28.1", path = "crates/egui_plot", default-features = false }
6260
egui-winit = { version = "0.28.1", path = "crates/egui-winit", default-features = false }
6361
egui_extras = { version = "0.28.1", path = "crates/egui_extras", default-features = false }
6462
egui-wgpu = { version = "0.28.1", path = "crates/egui-wgpu", default-features = false }

RELEASES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ We don't update the MSRV in a patch release, unless we really, really need to.
4444
- check the in-browser profiler
4545
* [ ] check the color test
4646
* [ ] update `eframe_template` and test
47+
* [ ] update `egui_plot` and test
4748
* [ ] update `egui_tiles` and test
4849
* [ ] test with Rerun
4950
* [ ] `./scripts/check.sh`
@@ -76,7 +77,6 @@ I usually do this all on the `master` branch, but doing it in a release branch i
7677
(cd crates/ecolor && cargo publish --quiet) && echo "✅ ecolor"
7778
(cd crates/epaint && cargo publish --quiet) && echo "✅ epaint"
7879
(cd crates/egui && cargo publish --quiet) && echo "✅ egui"
79-
(cd crates/egui_plot && cargo publish --quiet) && echo "✅ egui_plot"
8080
(cd crates/egui-winit && cargo publish --quiet) && echo "✅ egui-winit"
8181
(cd crates/egui_extras && cargo publish --quiet) && echo "✅ egui_extras"
8282
(cd crates/egui-wgpu && cargo publish --quiet) && echo "✅ egui-wgpu"
@@ -94,4 +94,5 @@ I usually do this all on the `master` branch, but doing it in a release branch i
9494

9595
## After release
9696
* [ ] publish new `eframe_template`
97+
* [ ] publish new `egui_plot`
9798
* [ ] publish new `egui_tiles`

crates/egui_demo_lib/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ default = []
3434
chrono = ["egui_extras/datepicker", "dep:chrono"]
3535

3636
## Allow serialization using [`serde`](https://docs.rs/serde).
37-
serde = ["egui/serde", "egui_plot/serde", "dep:serde", "egui_extras/serde"]
37+
serde = ["egui/serde", "dep:serde", "egui_extras/serde"]
3838

3939
## Enable better syntax highlighting using [`syntect`](https://docs.rs/syntect).
4040
syntect = ["egui_extras/syntect"]
@@ -43,7 +43,6 @@ syntect = ["egui_extras/syntect"]
4343
[dependencies]
4444
egui = { workspace = true, default-features = false, features = ["color-hex"] }
4545
egui_extras = { workspace = true, features = ["default"] }
46-
egui_plot = { workspace = true, features = ["default"] }
4746

4847
log.workspace = true
4948
unicode_names2 = { version = "0.6.0", default-features = false } # this old version has fewer dependencies

crates/egui_demo_lib/src/demo/context_menu.rs

Lines changed: 4 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
1-
use egui::Vec2b;
2-
3-
#[derive(Clone, Debug, PartialEq)]
1+
#[derive(Clone, Default, PartialEq, Eq)]
42
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
5-
enum Plot {
6-
Sin,
7-
Bell,
8-
Sigmoid,
9-
}
10-
11-
fn gaussian(x: f64) -> f64 {
12-
let var: f64 = 2.0;
13-
f64::exp(-(x / var).powi(2)) / (var * f64::sqrt(std::f64::consts::TAU))
14-
}
15-
16-
fn sigmoid(x: f64) -> f64 {
17-
-1.0 + 2.0 / (1.0 + f64::exp(-x))
18-
}
19-
20-
#[derive(Clone, PartialEq)]
21-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
22-
pub struct ContextMenus {
23-
plot: Plot,
24-
show_axes: Vec2b,
25-
allow_drag: bool,
26-
allow_zoom: bool,
27-
allow_scroll: bool,
28-
center_x_axis: bool,
29-
center_y_axis: bool,
30-
width: f32,
31-
height: f32,
32-
}
33-
34-
impl Default for ContextMenus {
35-
fn default() -> Self {
36-
Self {
37-
plot: Plot::Sin,
38-
show_axes: Vec2b::TRUE,
39-
allow_drag: true,
40-
allow_zoom: true,
41-
allow_scroll: true,
42-
center_x_axis: false,
43-
center_y_axis: false,
44-
width: 400.0,
45-
height: 200.0,
46-
}
47-
}
48-
}
3+
pub struct ContextMenus {}
494

505
impl crate::Demo for ContextMenus {
516
fn name(&self) -> &'static str {
@@ -66,95 +21,24 @@ impl crate::View for ContextMenus {
6621
fn ui(&mut self, ui: &mut egui::Ui) {
6722
ui.horizontal(|ui| {
6823
ui.menu_button("Click for menu", Self::nested_menus);
24+
6925
ui.button("Right-click for menu")
7026
.context_menu(Self::nested_menus);
27+
7128
if ui.ctx().is_context_menu_open() {
7229
ui.label("Context menu is open");
7330
} else {
7431
ui.label("Context menu is closed");
7532
}
7633
});
7734

78-
ui.separator();
79-
80-
ui.label("Right-click plot to edit it!");
81-
ui.horizontal(|ui| {
82-
self.example_plot(ui).context_menu(|ui| {
83-
ui.menu_button("Plot", |ui| {
84-
if ui.radio_value(&mut self.plot, Plot::Sin, "Sin").clicked()
85-
|| ui
86-
.radio_value(&mut self.plot, Plot::Bell, "Gaussian")
87-
.clicked()
88-
|| ui
89-
.radio_value(&mut self.plot, Plot::Sigmoid, "Sigmoid")
90-
.clicked()
91-
{
92-
ui.close_menu();
93-
}
94-
});
95-
egui::Grid::new("button_grid").show(ui, |ui| {
96-
ui.add(
97-
egui::DragValue::new(&mut self.width)
98-
.range(0.0..=f32::INFINITY)
99-
.speed(1.0)
100-
.prefix("Width: "),
101-
);
102-
ui.add(
103-
egui::DragValue::new(&mut self.height)
104-
.range(0.0..=f32::INFINITY)
105-
.speed(1.0)
106-
.prefix("Height: "),
107-
);
108-
ui.end_row();
109-
ui.checkbox(&mut self.show_axes[0], "x-Axis");
110-
ui.checkbox(&mut self.show_axes[1], "y-Axis");
111-
ui.end_row();
112-
if ui.checkbox(&mut self.allow_drag, "Drag").changed()
113-
|| ui.checkbox(&mut self.allow_zoom, "Zoom").changed()
114-
|| ui.checkbox(&mut self.allow_scroll, "Scroll").changed()
115-
{
116-
ui.close_menu();
117-
}
118-
});
119-
});
120-
});
12135
ui.vertical_centered(|ui| {
12236
ui.add(crate::egui_github_link_file!());
12337
});
12438
}
12539
}
12640

12741
impl ContextMenus {
128-
fn example_plot(&self, ui: &mut egui::Ui) -> egui::Response {
129-
use egui_plot::{Line, PlotPoints};
130-
let n = 128;
131-
let line = Line::new(
132-
(0..=n)
133-
.map(|i| {
134-
use std::f64::consts::TAU;
135-
let x = egui::remap(i as f64, 0.0..=n as f64, -TAU..=TAU);
136-
match self.plot {
137-
Plot::Sin => [x, x.sin()],
138-
Plot::Bell => [x, 10.0 * gaussian(x)],
139-
Plot::Sigmoid => [x, sigmoid(x)],
140-
}
141-
})
142-
.collect::<PlotPoints>(),
143-
);
144-
egui_plot::Plot::new("example_plot")
145-
.show_axes(self.show_axes)
146-
.allow_drag(self.allow_drag)
147-
.allow_zoom(self.allow_zoom)
148-
.allow_scroll(self.allow_scroll)
149-
.center_x_axis(self.center_x_axis)
150-
.center_x_axis(self.center_y_axis)
151-
.width(self.width)
152-
.height(self.height)
153-
.data_aspect(1.0)
154-
.show(ui, |plot_ui| plot_ui.line(line))
155-
.response
156-
}
157-
15842
fn nested_menus(ui: &mut egui::Ui) {
15943
ui.set_max_width(200.0); // To make sure we wrap long text
16044

crates/egui_demo_lib/src/demo/demo_app_windows.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ impl Default for Demos {
3636
Box::<super::painting::Painting>::default(),
3737
Box::<super::pan_zoom::PanZoom>::default(),
3838
Box::<super::panels::Panels>::default(),
39-
Box::<super::plot_demo::PlotDemo>::default(),
4039
Box::<super::scrolling::Scrolling>::default(),
4140
Box::<super::sliders::Sliders>::default(),
4241
Box::<super::strip_demo::StripDemo>::default(),

crates/egui_demo_lib/src/demo/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub mod painting;
2222
pub mod pan_zoom;
2323
pub mod panels;
2424
pub mod password;
25-
pub mod plot_demo;
2625
pub mod scrolling;
2726
pub mod sliders;
2827
pub mod strip_demo;

0 commit comments

Comments
 (0)