Ask Your Question

Plotting in base n?

asked 2020-10-10 08:20:18 -0500

nooniensoong97 gravatar image

In sagemath is there a way to represent plots in bases other then base10? If at all possible being able to plot from base2 to base36.

edit retag flag offensive close merge delete


Please provide an example of plot you would like to do.

slelievre gravatar imageslelievre ( 2020-10-10 11:36:11 -0500 )edit

Say I would like to use list_plot for a list of prime numbers in a base other then base10.

nooniensoong97 gravatar imagenooniensoong97 ( 2020-10-10 17:16:07 -0500 )edit

Try exploring the optional arguments ticks, tick_labels, tick_formatter of graphics objects.

slelievre gravatar imageslelievre ( 2020-10-11 06:42:25 -0500 )edit

So the program isn't designed to actually do any processing in other bases, and the only way is to format the plot to represent the said data as the intended base.

nooniensoong97 gravatar imagenooniensoong97 ( 2020-10-12 07:11:33 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-10-12 07:49:21 -0500

slelievre gravatar image

Internally computers work in base 2. Many humans are used to base 10.

Programming languages and computer algebra systems take that into account.

Typically they accept input in base 10, work on it in base 2, and display results in base 10.

In some cases one wants to use other bases. There are various levels of support for that.

It's not common enough that plotting functions have dedicated flags, but they often offer ways to tweak the display.

In matplotlib and in Sage, see ticks, tick_labels, tick_formatter.

edit flag offensive delete link more


I was expecting that this program would be designed to have full support for any bases from base 2 to base 36. I guess maybe a possible add on in future updates? Also looks like the ticks, tick_labels, and tick_format only works on plot function. I tried it on list_plot and got an error.

nooniensoong97 gravatar imagenooniensoong97 ( 2020-10-12 08:33:10 -0500 )edit

Not clear to me what "full support" could mean. Or what the concrete question is.

Or what would be an example of something you would like to work but does not work.

slelievre gravatar imageslelievre ( 2020-10-12 16:00:57 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-10-10 08:20:18 -0500

Seen: 53 times

Last updated: Oct 12