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

Automatic dark filter for plots #6255

Closed
jmcphers opened this issue Feb 10, 2025 · 1 comment
Closed

Automatic dark filter for plots #6255

jmcphers opened this issue Feb 10, 2025 · 1 comment
Labels
area: plots Issues related to Plots category.

Comments

@jmcphers
Copy link
Collaborator

Positron's dark themes don't extend to the Plots pane, because plots are images generated from matplotlib, ggplot, etc. Consequently it's not unusual to see a bright white plot in an otherwise dark-themed Positron. It is possible to set the plotting libraries to generate dark-themed plots, but this usually requires some level of effort and skill with the individual plotting library.

When preparing plots for publication, you probably want them to have their true colors, but for exploratory data analysis, the plots could Just Look Nice in Positron with some judicious use of CSS color filters.

(From a conversation with @cscheid at Work Week)

@jmcphers jmcphers added the area: plots Issues related to Plots category. label Feb 10, 2025
@juliasilge juliasilge added this to the 2025.03 Pre-Release milestone Feb 10, 2025
jmcphers added a commit that referenced this issue Feb 10, 2025
Quick little airplane feature to make plots in Positron's Plots pane
(and editors) automatically turn dark in dark themes. It's intended for
exploratory data analysis, wherein you're not preparing plots for
publication but just using them as a visualization tool.


https://github.com/user-attachments/assets/19d49c58-2c26-411a-b0c4-8c440b17d2cf

Because I expect that this feature will be somewhat polarizing, it is
controlled by a explicit configuration setting rather than an implicitly
saved preference. You can turn it off at user level, workspace level,
etc. in Settings.

<img width="473" alt="image"
src="https://github.com/user-attachments/assets/cc8b1775-0537-49ae-a36d-192321321570"
/>

Addresses #6255.

### Release Notes


#### New Features

- Optionally apply a color filter to plots in dark mode for automatic
theming (#6255)

#### Bug Fixes

- N/A

### QA Notes

It is possible to change the dark filter mode right on the Plots pane by
clicking the color mode drop down. Note however that this only changes
it temporarily! If you want the change to stick (across reloads, etc.)
you need to do that in Settings. Changing the value in Settings should
cause the UI to react appropriately.

I briefly considered having the dropdown update the setting for you but
there's really too much guessing there (did you mean to turn it off for
all projects? just this one? etc.)

Test tags: `@:plots`
@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2025.03.0-11
OS Version          : OSX

Test scenario(s)

Validated with

import pandas as pd
import matplotlib.pyplot as plt
data_dict = {'name': ['p1', 'p2', 'p3', 'p4', 'p5', 'p6'],
				'age': [20, 20, 21, 20, 21, 20],
				'math_marks': [100, 90, 91, 98, 92, 95],
				'physics_marks': [90, 100, 91, 92, 98, 95],
				'chem_marks': [93, 89, 99, 92, 94, 92]
				}

df = pd.DataFrame(data_dict)

df.plot(kind='scatter',
		x='math_marks',
		y='physics_marks',
		color='red')

plt.title('ScatterPlot')
plt.show()

Link(s) to TestRail test cases run or created:

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: plots Issues related to Plots category.
Projects
None yet
Development

No branches or pull requests

3 participants