LoginSignup
0
0

More than 1 year has passed since last update.

Plots.jl

Julia のグラフ描画パッケージです。

領域の描画

コード

$(x_1, y_1), (x_2, y_2), (x_3, y_3)$を通る領域を次のように描画できます。

plot(Shape([x1, x2, x3, ...], [y1, y2, y3, ...]))

次の領域を描画します.
$$
\begin{eqnarray}
y &\geq& x + 1,\\
y &\geq& \frac{-x + 15}{6},\\
x &\geq& 0, ~~ y \geq 0
\end{eqnarray}
$$

このようにコードを書きました。

using Plots

plot(
    x -> x + 1,
    color=:blue,
    xlims=(0,2),
    ylims=(0,3.3),
    xlabel="x",
    ylabel="y",
    legend=false
)
plot!(x -> (-x + 15) / 6, color=:red)
plot!(Shape([0, 0, 9/7], [1, 5/2, 16/7]), color=:grey, opacity=0.1)

コードの出力のグラフは次の通りです。

$(0, 1), (0, 5/2), (9/7, 16/7)$の3点を頂点とする領域が描画できています.

参考ページ

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0