3D pictures in Plots.jl

Hi everybody! I’m interested in drawing some algebraic varieties from the book i’m reading right now (Cox, Little, O’Shea).
Is it possible to draw

  1. Plots in implicit form (like elliptic curves Y^2 = X^3 + aX + b) in 2d and 3d (for instance, X^2-Y^2*Z^2+Z^3==0)
  2. Plots in parametric form, like twisted cubic (x = t, y = t^2, z = t^3) and parametric surfaces (x = x(u,v), y = y(u,v), z = z(u,v))

Currently I found only surface plots in the form:
surface(xGrid, yGrid, (x, y) -> x^2 + y^2)

but for some reasons it works really laggy, especially when i try to move picture.
I thought it would be easier for my laptop to draw only wire of the surface, but
wireframe(xGrid, yGrid, (x, y) -> x^2 + y^2)
doesn’t work

Gadfly can do contours and vectorfields of functions, examples here.

Makie.jl is very good for things like this.

Thanks for pointing out, but unfortunately i have unexpected problems with installation of Makie, namely with building GLFW (the message is really huge and confusing and i’m stuck with it:
Error: Error building GLFW:
make: *** No rule to make target ‘install’. Stop.
)

Are you using Julia 1.0?

Are you on linux and forgot to install:

sudo apt-get install ffmpeg cmake xorg-dev
julia>] build GLFW

sudo apt-get install xorg-dev cmake ffmpeg
<…>
cmake is already the newest version (3.5.1-1ubuntu3).
xorg-dev is already the newest version (1:7.7+13ubuntu3.1).
ffmpeg is already the newest version (7:2.8.15-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 279 not upgraded.

] build GLFW
<…>
ERROR: LoadError: failed process: Process(setenv(/home/kir/.julia/packages/CMake/xNoo8/deps/usr/bin/cmake --build . --target install<…>), ProcessExited(2))

Yes.

can you post the full error?

and your os + environment, graphics card :wink:

kir@kir-ThinkPad-E480
inxi
CPU Dual core Intel Core i3-8130U (-HT-MCP-) speed/max 1216/3400 MHz Kernel 4.10.0-38-generic x86_64 Up 12 days Mem 2103.0/3846.9MB HDD 1000.2GB(3.4% used) Procs 221 Client Shell inxi 2.2.35
kir@kir-ThinkPad-E480 ~ $ inxi -G
Graphics: Card: Intel Device 5917
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
Resolution: 1366x768@60.00hz
GLX Renderer: Mesa DRI Intel Kabylake GT1.5
GLX Version: 3.0 Mesa 17.0.7

FULL TEXT:

(v1.0) pkg> build GLFW
Building Homebrew → ~/.julia/packages/Homebrew/l8kUw/deps/build.log
Building CMake ───→ ~/.julia/packages/CMake/xNoo8/deps/build.log
Building GLFW ────→ ~/.julia/packages/GLFW/pkSlg/deps/build.log
┌ Error: Error building GLFW:
│ make: *** No rule to make target ‘install’. Stop.
│ [ Info: Attempting to create directory /home/kir/.julia/packages/GLFW/pkSlg/deps/downloads
│ [ Info: Directory /home/kir/.julia/packages/GLFW/pkSlg/deps/downloads already exists
│ [ Info: Downloading file https://github.com/glfw/glfw/archive/3.2.1.tar.gz
│ [ Info: Done downloading file https://github.com/glfw/glfw/archive/3.2.1.tar.gz
│ [ Info: Attempting to create directory /home/kir/.julia/packages/GLFW/pkSlg/deps/src
│ [ Info: Directory /home/kir/.julia/packages/GLFW/pkSlg/deps/src already exists
│ [ Info: Attempting to create directory /home/kir/.julia/packages/GLFW/pkSlg/deps
│ [ Info: Directory /home/kir/.julia/packages/GLFW/pkSlg/deps already exists
│ [ Info: Path /home/kir/.julia/packages/GLFW/pkSlg/deps/src/glfw-3.2.1 already exists
│ [ Info: Attempting to create directory /home/kir/.julia/packages/GLFW/pkSlg/deps/builds/glfw
│ [ Info: Directory /home/kir/.julia/packages/GLFW/pkSlg/deps/builds/glfw already exists
│ [ Info: Changing directory to /home/kir/.julia/packages/GLFW/pkSlg/deps/builds/glfw
│ [ Info: Changing directory to /home/kir/.julia/packages/GLFW/pkSlg/deps/builds/glfw
│ ERROR: LoadError: failed process: Process(setenv(/home/kir/.julia/packages/CMake/xNoo8/deps/usr/bin/cmake --build . --target install,[“PATH=/home/kir/.julia/packages/GLFW/pkSlg/deps/usr/bin:/home/kir/anaconda3/bin:/home/kir/bin:/home/kir/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games”, “SESSION=xfce”, “DEFAULTS_PATH=/usr/share/gconf/xfce.default.path”, “QT_ACCESSIBILITY=1”, “UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/2276”, “GLADE_PIXMAP_PATH=:”, “UPSTART_JOB=startxfce4”, “DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-VgXsv9yQWI”, “XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0”, “XDG_SESSION_DESKTOP=xfce”, “GTK_OVERLAY_SCROLLING=0”, “SSH_AGENT_PID=2604”, “XDG_SESSION_TYPE=x11”, “USER=kir”, “XDG_CONFIG_DIRS=/etc/xdg/xdg-xfce:/usr/share/upstart/xdg:/etc/xdg:/etc/xdg”, “LC_NUMERIC=ru_RU.UTF-8”, “QT_IM_MODULE=”, “LESSCLOSE=/usr/bin/lesspipe %s %s”, “QT_STYLE_OVERRIDE=gtk”, “LC_MEASUREMENT=ru_RU.UTF-8”, “SESSIONTYPE=”, “INSTANCE=”, “CLUTTER_BACKEND=x11”, “GDMSESSION=xfce”, “LC_TELEPHONE=ru_RU.UTF-8”, “CLUTTER_IM_MODULE=”, “XDG_DATA_DIRS=/usr/share/xfce:/usr/share/xfce4:/home/kir/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/usr/share”, “LESSOPEN=| /usr/bin/lesspipe %s”, “SHELL=/bin/bash”, “XDG_SEAT=seat0”, “XAUTHORITY=/home/kir/.Xauthority”, “XDG_MENU_PREFIX=xfce-”, “GTK_MODULES=gail:atk-bridge”, “GNOME_KEYRING_PID=”, “GTK_IM_MODULE=”, “SESSION_MANAGER=local/kir-ThinkPad-E480:@/tmp/.ICE-unix/2538,unix/kir-ThinkPad-E480:/tmp/.ICE-unix/2538”, “XMODIFIERS=”, “GLADE_CATALOG_PATH=:”, “TERM=xterm-256color”, “HOME=/home/kir”, “COLORTERM=xfce4-terminal”, “VTE_VERSION=4205”, “IM_CONFIG_PHASE=1”, “UPSTART_INSTANCE=”, “XDG_CURRENT_DESKTOP=XFCE”, “LANG=en_US.UTF-8”, “SHLVL=1”, “LOGNAME=kir”, “LC_MONETARY=ru_RU.UTF-8”, “XDG_RUNTIME_DIR=/run/user/1000”, “SSH_AUTH_SOCK=/tmp/ssh-ZNlHAcCJSULL/agent.2603”, “DESKTOP_SESSION=xfce”, “GDM_LANG=en_US”, “LC_PAPER=ru_RU.UTF-8”, “LC_ADDRESS=ru_RU.UTF-8”, “_=/usr/local/bin/julia”, “GLADE_MODULE_PATH=:”, “PWD=/home/kir”, “DISPLAY=:0.0”, “UPSTART_EVENTS=started xsession”, “LANGUAGE=en_US”, “XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/kir”, “XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0”, “XDG_VTNR=7”, “WINDOWID=71303171”, “MANDATORY_PATH=/usr/share/gconf/xfce.mandatory.path”, “XDG_SESSION_ID=c2”, “LC_NAME=ru_RU.UTF-8”, “LC_IDENTIFICATION=ru_RU.UTF-8”, “JULIA_LOAD_PATH=@:/tmp/tmpeyCbNZ”, “QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1”, “QT4_IM_MODULE=”, “LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36:”, “JOB=dbus”, “GNOME_KEYRING_CONTROL=”, “OPENBLAS_MAIN_FREE=1”]), ProcessExited(2)) [2]
│ Stacktrace:
│ [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
│ [2] pipeline_error at ./process.jl:695 [inlined]
│ [3] #run#505(::Bool, ::Function, ::Cmd) at ./process.jl:653
│ [4] run(::Cmd) at ./process.jl:651
│ [5] macro expansion at ./logging.jl:308 [inlined]
│ [6] run(::BinDeps.SynchronousStepCollection) at /home/kir/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:518
│ [7] run(::FileRule) at /home/kir/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:483
│ [8] macro expansion at ./logging.jl:308 [inlined]
│ [9] run(::BinDeps.SynchronousStepCollection) at /home/kir/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:518
│ [10] macro expansion at ./logging.jl:308 [inlined]
│ [11] run(::BinDeps.SynchronousStepCollection) at /home/kir/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:518
│ [12] satisfy!(::BinDeps.LibraryDependency, ::Array{DataType,1}) at /home/kir/.julia/packages/BinDeps/ZEval/src/dependencies.jl:944
│ [13] satisfy!(::BinDeps.LibraryDependency) at /home/kir/.julia/packages/BinDeps/ZEval/src/dependencies.jl:922
│ [14] top-level scope at /home/kir/.julia/packages/BinDeps/ZEval/src/dependencies.jl:977
│ [15] include at ./boot.jl:317 [inlined]
│ [16] include_relative(::Module, ::String) at ./loading.jl:1038
│ [17] include(::Module, ::String) at ./sysimg.jl:29
│ [18] include(::String) at ./client.jl:388
│ [19] top-level scope at none:0
│ in expression starting at /home/kir/.julia/packages/GLFW/pkSlg/deps/build.jl:46
└ @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068

OK not sure what this is… could be multiple GLFW versions?
You could try:

sudo apt-get install libglfw3
]build GLFW

Also, make sure that you’ve installed the official intel gpu drivers and that you’re not using linux mesa default drivers … I’m not a 100% sure from your data if that’s already the case :wink:

1 Like

I’ve been browsing the galleries of Makie, and it seems nice.

  • Any plans to give it a Plots-compatible interface? Or should one just make a switch?
  • Any support for LaTeX syntax math, etc.?

I put a set of working Plots.jl examples into http://julia.cookbook.tips/ .

1 Like