Skip to content

UnicodePlots extension#118

Merged
chmerdon merged 1 commit intomainfrom
chmerdon/unicode_extension
Apr 15, 2026
Merged

UnicodePlots extension#118
chmerdon merged 1 commit intomainfrom
chmerdon/unicode_extension

Conversation

@chmerdon
Copy link
Copy Markdown
Member

@chmerdon chmerdon commented Apr 9, 2026

I started with a UnicodePlots extension and first moved the gridplot! from ExtandableFEMBase over. I tried to use as many ctx kwargs as possible and also added a proper bface coloring that was missing before. I also added a legend for the cell and bface colors. CellRegions coloring in 2D at the moment works by coloring a pixel at the cell midpoints. Also, at the moment the function just returns the plot which should cause a write into the terminal. Later this should be done by reveal, I guess.

You can test it with
GridVisualize.gridplot(uniform_refine(grid_lshape(Triangle2D)); Plotter = UnicodePlots, size = (40,20), aspect = 1, color = :yellow, title = "gridplot")

The 2D scalarplot works via Extendable.interpolate! onto a rectangular simplexgrid. Wtih WIAS-PDELib/ExtendableGrids.jl#120 this also works if the real grid is not rectangular.

UnicodePlots also offers something like a layout to group several plots... but that is for later ^^

ex = extrema(view(coords, 1, :))
ey = extrema(view(coords, 2, :))

X = LinRange(ex[1], ex[2], resolution[1])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I played a bit around and this throws errors on my end, since resolution may have floating point values. LinRange only accepts integers for the third argument. collect(ex[1]:(1/ resolution[1]):ex[2])?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or just resolution = @. Int(round(ctx[:size]))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, I incorporated your suggestion

Comment thread ext/GridVisualizeUnicodePlotsExt.jl Outdated
)

func = funcs[1]
resolution = resolution = @. Int(round(ctx[:size]))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

resolution is twice here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Upsi

@pjaap pjaap force-pushed the chmerdon/unicode_extension branch from 8ab3d70 to 3e7c513 Compare April 15, 2026 14:13
@pjaap pjaap force-pushed the chmerdon/unicode_extension branch from 3e7c513 to bad8fb2 Compare April 15, 2026 14:15
@chmerdon chmerdon merged commit 351babe into main Apr 15, 2026
8 of 9 checks passed
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.

2 participants