# Illustrating a point from a function in p-dimensional space

Are there any ‘pre-built’ utilities for plotting/illustrating a point in p-dimensional space?

Specifically, the value returned by a function with p-parameters.

I’ve hand sketched an illustration of the point in terms of the partial derivatives of the function wrt to each parameter at the point of interest, and was hoping that someone has tackled the problem of generating such illustrations.

Example:

I am not sure I understand this plot fully, but can’t you just plot “slices” (along axes, or arbitrary vectors) of an \mathbb{R}^n \to \mathbb{R} function as multiple plots?

Yes, that is the usual approach.
I’ve found some students would often accept (understand would be too strong) a multivariate/parameter function illustration such as the above rather than a neat panel showing the same plots arranged under/next to each other.

I was hoping to stop making crude drawings and make something a little neater

This is a pretty customized illustration. I am sure that it can be put together in TikZ (and thus PGFPlotsX.jl), although I assume it is nontrivial amount of work — you are in the best position to decide how important this is for you, but it can be done.

Plotting has a more or less standardized visual language, and students may be better off just becoming familiar with that. No doubt custom illustrations can be nice and illuminating, but since they are very costly they are rarely done, and decoding the visual language of something one-off may not be worth the investment for the reader.

2 Likes

Thanks, that’ll be a start.

Not in Julia (yet, I’ll see about adding it to Grassmann.jl), but would something like this work ?

https://enkimute.github.io/ganja.js/examples/coffeeshop.html#nzUWfYz0k

You can easily change the function there, and it will handle any number of arguments.

(update: made it interactive, you can drag the point in 5 dimensions, it gets projected on each of the five axi sticking out of p to find the coefficient for that dimension.).

(removed old image here - I’m only allowed to post 1)

(edit: I just realized you want slightly different behavior - dragging p to move the cross and project onto the x-axis of each of the graphs for the coordinate in that dimension - I’ll have a go at that in a bit)

==============

Update … I believe the current version (same link) is more what you had in mind. Pretty fun way of displaying high-d scalar fields !

6 Likes

Here’s how you can reproduce @enkimute example with

using Blink, Ganja
w = Window()


To further customize the plot, the ganja script could be changed using metaprogramming.

It would be fairly easy to change the function f used with some metaprogramming.

With the help of @enkimute I plan on creating some more plotting tools based on ganja.js

5 Likes

That is great thanks. That example is 70% of the functionality - in the example context described below the current implementations fix the axes and allow the point to move. I’ve found the alternative useful: fix the point and allow the graphs/axes to move clockwise-anti-clockwise.

To clarify the use case I describe:

1. Imagine a 3-D image. There are two ways of visualizing changes:
a.) Picture the axes fixed and the point moves along the plane/surface
b.) Picture the point fixed and the axes move around.
2. in +3-D it is hard to picture the axes fixed… instead adopt the idea of 1 b) and visualize the point is fixed and imagine the axes move around.

One other way this changes the visualization is to ask what happens if the limit of the 2-D partial-derivative plot is reached? In that case imagine the plot moving/re-drawn clockwise/anti-clockwise.

But these are pretty much on point for practical purposes - thanks for the effort.

1 Like