{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Parasite Simple2\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nimport matplotlib.transforms as mtransforms\nfrom mpl_toolkits.axes_grid1.parasite_axes import HostAxes\n\nobs = [[\"01_S1\", 3.88, 0.14, 1970, 63],\n       [\"01_S4\", 5.6, 0.82, 1622, 150],\n       [\"02_S1\", 2.4, 0.54, 1570, 40],\n       [\"03_S1\", 4.1, 0.62, 2380, 170]]\n\n\nfig = plt.figure()\n\nax_kms = fig.add_subplot(axes_class=HostAxes, aspect=1)\n\n# angular proper motion(\"/yr) to linear velocity(km/s) at distance=2.3kpc\npm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5\n\naux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.)\nax_pm = ax_kms.twin(aux_trans)\n\nfor n, ds, dse, w, we in obs:\n    time = ((2007 + (10. + 4/30.)/12) - 1988.5)\n    v = ds / time * pm_to_kms\n    ve = dse / time * pm_to_kms\n    ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color=\"k\")\n\n\nax_kms.axis[\"bottom\"].set_label(\"Linear velocity at 2.3 kpc [km/s]\")\nax_kms.axis[\"left\"].set_label(\"FWHM [km/s]\")\nax_pm.axis[\"top\"].set_label(r\"Proper Motion [$''$/yr]\")\nax_pm.axis[\"top\"].label.set_visible(True)\nax_pm.axis[\"right\"].major_ticklabels.set_visible(False)\n\nax_kms.set_xlim(950, 3700)\nax_kms.set_ylim(950, 3100)\n# xlim and ylim of ax_pms will be automatically adjusted.\n\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}