Skip to content

feat: Support custom and default titles in both graphics and plot objects.#637

Merged
prmukherj merged 6 commits intomainfrom
maint/support_titles_for_graphics
Feb 5, 2026
Merged

feat: Support custom and default titles in both graphics and plot objects.#637
prmukherj merged 6 commits intomainfrom
maint/support_titles_for_graphics

Conversation

@prmukherj
Copy link
Collaborator

@prmukherj prmukherj commented Feb 3, 2026

image

All plots now come with a default title. These titles can be over-written by a user-defined title passed as argument during adding a graphics or plot as shown.

    win = GraphicsWindow()
    win.add_graphics(pathlines, position=(0, 0))
    win.add_plot(residual, position=(0, 1), title="Residual History")
    win.show()
image

AND,

    graphics_window = GraphicsWindow()

    mesh = Mesh(show_edges=True, surfaces=WallBoundaries())
    graphics_window.add_graphics(mesh, position=(0, 0), title="Default Mesh")

    mesh = Mesh(surfaces=WallBoundaries())
    graphics_window.add_graphics(mesh, position=(0, 1))

    graphics_window.show()
image

@seanpearsonuk
Copy link
Collaborator

@prmukherj For no title (i.e. overriding the default), does the caller just pass title = ""?

@seanpearsonuk
Copy link
Collaborator

Note that Variable Descriptors contain a human-friendly name string (a quality not necessarily guaranteed via the Fluent names). By basing names on Variable Descriptors, we might also be able to take advantage of that framework's localisation features in future.

@prmukherj
Copy link
Collaborator Author

@prmukherj For no title (i.e. overriding the default), does the caller just pass title = ""?

title=None, can also be passed. So we should update the type-hints, right?

@mkundu1
Copy link
Collaborator

mkundu1 commented Feb 3, 2026

Not related to the window title, but is the truncated colormap title in the attached images a known issue? Maybe add a github tracker for it

@prmukherj
Copy link
Collaborator Author

Not related to the window title, but is the truncated colormap title in the attached images a known issue? Maybe add a github tracker for it

Created an issue: #638

Should be a simple investigative fix from PyVista.

@seanpearsonuk
Copy link
Collaborator

seanpearsonuk commented Feb 3, 2026

@prmukherj For no title (i.e. overriding the default), does the caller just pass title = ""?

title=None, can also be passed. So we should update the type-hints, right?

@prmukherj, Please could you answer the question, which was 'For no title (i.e. overriding the default), does the caller just pass title = ""?'. You gave the answer "title=None, can also be passed.", which is unsatisfactory, in my opinion, as you didn't say anything about what title=None is meant to indicate, and that leaves me confused. Moreover, since the implementation is able to generate default titles and the title argument is provided as an optional override, that would seem to imply that the title argument itself is probably chosen to be None by default in order for the implementation to cleanly distinguish between the different use cases. Are you now actually suggesting instead that title has some other default? Either way, I don't understand.

@prmukherj
Copy link
Collaborator Author

prmukherj commented Feb 5, 2026

@prmukherj For no title (i.e. overriding the default), does the caller just pass title = ""?

title=None, can also be passed. So we should update the type-hints, right?

@prmukherj, Please could you answer the question, which was 'For no title (i.e. overriding the default), does the caller just pass title = ""?'. You gave the answer "title=None, can also be passed.", which is unsatisfactory, in my opinion, as you didn't say anything about what title=None is meant to indicate, and that leaves me confused. Moreover, since the implementation is able to generate default titles and the title argument is provided as an optional override, that would seem to imply that the title argument itself is probably chosen to be None by default in order for the implementation to cleanly distinguish between the different use cases. Are you now actually suggesting instead that title has some other default? Either way, I don't understand.

ok, I got your point now. Passing title="", is same as passing title=None, i.e. it will fall back to the default title. Do we want the feature to behave like passing title="" should overload default?
@seanpearsonuk

@prmukherj
Copy link
Collaborator Author

@prmukherj For no title (i.e. overriding the default), does the caller just pass title = ""?

title=None, can also be passed. So we should update the type-hints, right?

@prmukherj, Please could you answer the question, which was 'For no title (i.e. overriding the default), does the caller just pass title = ""?'. You gave the answer "title=None, can also be passed.", which is unsatisfactory, in my opinion, as you didn't say anything about what title=None is meant to indicate, and that leaves me confused. Moreover, since the implementation is able to generate default titles and the title argument is provided as an optional override, that would seem to imply that the title argument itself is probably chosen to be None by default in order for the implementation to cleanly distinguish between the different use cases. Are you now actually suggesting instead that title has some other default? Either way, I don't understand.

ok, I got your point now. Passing title="", is same as passing title=None, i.e. it will fall back to the default title. Do we want the feature to behave like passing title="" should overload default? @seanpearsonuk

Just to summarize the behavior now:

  1. If user don't pass the title argument (it is optional), they get the default title.
  2. If user passes None or "" as title still they will get default title.
  3. If user passes a custom title then the title will be updated. So, overwriting the title (to show no title) now is only possible by passing " ".

We can handle this by updating the checks so that if user pass "", then also the default title will be over-written with no title if that is required.

@seanpearsonuk
Copy link
Collaborator

We can handle this by updating the checks so that if user pass "", then also the default title will be over-written with no title if that is required.

Yes, please. That's what I had in mind.

@prmukherj
Copy link
Collaborator Author

We can handle this by updating the checks so that if user pass "", then also the default title will be over-written with no title if that is required.

Yes, please. That's what I had in mind.

Done:
image

graphics_window = GraphicsWindow()
graphics_window.add_graphics(mesh, position=(0, 0), title="")
graphics_window.add_graphics(mesh, position=(0, 1))
graphics_window.show()

Copy link
Collaborator

@seanpearsonuk seanpearsonuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think I had a clear picture of the state of the code in this repo. I’m approving these changes, but I’ve found them hard to validate through code review alone. I also noticed a considerable amount of duplication in the recent changes.

@prmukherj prmukherj merged commit eff1397 into main Feb 5, 2026
20 checks passed
@prmukherj prmukherj deleted the maint/support_titles_for_graphics branch February 5, 2026 12:20
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

Successfully merging this pull request may close these issues.

Support titles in both graphics and plots -> generate defaults as well.

4 participants