Julia&Juno: はじめ方4_グラフにラインと文字を入れる ver. 2

Last Updated on August 9, 2021 by shibatau

タイトルを修正しました。

はじめ方1_インストールとグラフの作成

はじめ方2_データフレームとパイプ演算子

はじめ方3_データフレームの集計

はじめ方4_グラフにラインと文字を入れる

 

I.グラフにラインと文字をいれる

 

次に説明されています。

 

Gadfly.jl

 

縦に2本の実線を描く式は次です。

 

xintercept=[15.0, 60.0], Geom.vline(style=:solid)

 

横に2本の点線を描く式は次です。

 

,yintercept=[45.0, 95.0], Geom.hline(style=:dot)

 

テキストを挿入する式は次です。

 

 Guide.annotation(compose(context(), text(3,88, “JAPANESE”), fill(“gold”))))

 

スクリプト

 

using Gadfly
using CSV, DataFrames
using DataFramesMeta
using HTTP
using Statistics
using Compose
p1 = plot(df0, x=:english, y=:japanese, color=:nationality, 
    Geom.point, Guide.xlabel("english"), Guide.ylabel("japanese"),
    Guide.colorkey(title="English-Japanese by nationality"),
    xintercept=[15.0, 60.0], Geom.vline(style=:solid),
    yintercept=[45.0, 95.0], Geom.hline(style=:dot),
    Guide.annotation(compose(context(), text(3,88, "JAPANESE"), fill("gold"))))
img = SVG("text1.svg", 14cm, 8cm)
draw(img, p1)

 

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.