I would like to:
- plot the function
(-0.06*x^(3))+(0.29*x^(2))-(0.65*x)+2
EDIT: The main goal is to plot a function through the points (-1,3), (4,0), (6,5) and (0,2)
- keep a ratio 1:1
About plotting the function:
on Geogebra, the function looks like:
While on Latex, the function looks like:
The function must pass throught the point (4,0) and (6,-5). I searched on internet and I increased the sampling but it doesn't solve the problem. I've got an error from the compilator but it doesn't give much information (maybe due to overleaf? it doesn't know "the key tikz draw blue").
About keeping the ratio 1:1 :
I searched on internet and tried several solutions, but it was unconclusive
Main.tex:
%%%%%%%%%%%%%%%%%% INTRODUCTION %%%%%%%%%%%%%%%%%%
\documentclass[border=10pt]{standalone}
%%%%%%%%%%%%%%%%%% PACKAGE %%%%%%%%%%%%%%%%%%
\usepackage{tikz, tkz-euclide}% permet de dessiner des figures, des graphiques
\usepackage{pgfplots}
\usepackage{adjustbox}% permet de déterminer une taille de fenêtre
%% FONT
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgadventor}% paquet de police de caractère TGadventor
\usepackage{sansmath}% Copie-colle la police active dans
% \sfdefault (/!\ N'EST PAS UNE POLICE DE CARACTÈRES)
\usepackage{xcolor}
%%%%%%%%%%%%%%%%%% INPUT %%%%%%%%%%%%%%%%%%
%\input{preamble.tex}
%\input{parameters.tex}
%\input{types/f2d_fig}
%%%%%%%%%%%%%%%%%% DOCUMENT %%%%%%%%%%%%%%%%%%
\begin{document}
\begin{adjustbox}{width={15cm},totalheight={15cm},keepaspectratio}
\begin{tikzpicture}[font={\sansmath\sffamily},thick, line cap=round, line join=round, >=latex, x=1.0cm, y=1.0cm]
%%%%%%%%%%%%%%%%%% Data Table %%%%%%%%%%%%%%%%%%
\begin{axis}[%
width=15cm,
xlabel=$x$,ylabel=$y$,
xmin=-10, xmax=10,
ymin=-8,ymax=8,
%minor xtick={-10,-9,...,8},
%minor ytick={-8,-7,...,8},
domain=-10:10,
minor tick num=1,
grid=both,
axis lines = middle,
enlargelimits=false,
thick,
smooth,
samples=5000,
]%
\draw[color=blue, opacity=0.8] (axis cs:-9,2) coordinate node [circle, fill=blue, draw=blue, scale=.5] {} -- (axis cs:-2,5) coordinate node [circle, fill=white, draw=blue, scale=.5] {};
\addplot[%
color=blue,
opacity=0.8,
domain=-1:6,
]%
{(-0.06*x^(3))+(0.29*x^(2))-(0.65*x)+2}
node [circle, fill=white, draw=blue, scale=.5, pos=0] {}
node [above right, pos=0.3] {g(x)}
node [circle, fill=blue, draw blue, scale=.5, pos=1] {};
\end{axis}
\end{tikzpicture}
\end{adjustbox}
\end{document}
@koleygr
mentioned, the point (4,0) it's not in the domain of your function, for example. – Sebastián V. Romero Mar 9 '20 at 11:48draw blue
instead of adraw=blue
in the third node options... – Rmano Mar 9 '20 at 13:14