Commit fdcebd5
Add ability to specify color and font of axis tick labels for each axis (#155)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui_plot/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo f or a new
example.
* Do NOT open PR:s from your `master` or `main` branch, as that makes it
hard for maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! We will review your PR, but our time is limited!
-->
This allows specifying the color and font (through FontId) of the tick
labels for each axis on a plot
<img width="1329" height="867" alt="image"
src="https://github.com/user-attachments/assets/a5e683e4-0163-40d4-8955-0ca106ec12d0"
/>
All feedback and criticism of the API and implementation are much
appreciated. I will note, to ensure that the fading of the tick label
color is respected, I did the following
```
let text_color = if let Some(color) = self.hints.tick_label_color {
color.gamma_multiply(strength.sqrt())
} else {
super::color_from_strength(ui, strength)
};
```
and I don't love the duplication of the gamma_multiply, I just didn't
want to touch the color_from_strength function without the all clear.
* Closes <#154>
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: Tommi Kabelitz <tommi.kabelitz@priorianalytica.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>1 parent e03309f commit fdcebd5
1 file changed
Lines changed: 29 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| 95 | + | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| |||
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
160 | 179 | | |
161 | 180 | | |
162 | 181 | | |
| |||
274 | 293 | | |
275 | 294 | | |
276 | 295 | | |
277 | | - | |
278 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
279 | 305 | | |
280 | 306 | | |
281 | 307 | | |
| |||
0 commit comments