# Nice plot of f(x)

A user has this nice graph of f(x) on his profile and I want to learn how to do it in matlab or Gnu octave.

f(x) = -(x*x*x +x + 1)
(0,0) = center
color(x,y) = arctan2(x, f(x))
lum(x,y) = sin(hypot(x, f(x))/alpha)


But when I try in matlab I fail:

>> y= -(x.*x.*x+x+1)

>> x = linspace(0,2*pi,100);

>> plot(x,y)

The matlab code does not make a plot that resembles the nice visual graph. I understand that I must also accomplish the effects, but can you help me on the way? Is there a program that is more or less suitable to make a plot like the above?

• Why don't you ask the user from whose site you copied the picture? – Wolfgang Bangerth Jun 3 '16 at 4:01
• I may misunderstood but your three MATLAB code lines are completely off topic. You need at least a contour command to reproduce the isocontour lines you have displayed, not a plot command. Only then you can focus on the colormap used for obtaining such a graph but it seems to have been postprocessed with another software. – Coriolis Jun 3 '16 at 7:43

Using Python and mpmath:

import matplotlib
import mpmath
f = lambda z: z**3-z+1
mpmath.cplot(f, points=100000)


Easy peasy.... See here for the documentation on mpmath.cplot