我有一个在x轴上有日期的散景图(data["obs_date"]
),我希望顶部的另一个x轴覆盖相同的范围,但以不同的格式显示(mjd
以下)
我尝试添加第二个轴:
plot.extra_x_ranges = {"MJD":
Range1d(start=Time(min(data["obs_date"])).mjd,
end=Time(max(data["obs_date"])).mjd)}
plot.add_layout(LinearAxis(x_range_name="MJD", axis_label="MJD",
axis_label_text_font_size="16pt"),
"above")
但是,因为散景会在情节的极限上添加一个小缓冲区,使用min
的{{1}} max
作为此新轴的限制会给我一个小的偏移 - 在data["obs_date"]
下方的图片应与16 Jan 2018
对齐。当我只有一点绘图时,它也会导致它破裂。
如何设置新轴的极限以便“了解”主轴的极限?来自matplotlib背景,我想我正在寻找的等价物是58134
。
答案 0 :(得分:2)
Bokeh隐式使用.hidden {
display: none;
}
.active {
font-weight: bold;
}
根据其<div class="card text-center">
<div class="card-header pb-0">
<ul id="contactGroups" class="nav justify-content-center nav-tabs card-header-tabs">
<li class="nav-item" data-id="1">
<a class="nav-link active" href="#">Contact Us</a>
</li>
<li class="nav-item" data-id="2">
<a class="nav-link" href="#">Business Enquiries</a>
</li>
<li class="nav-item" data-id="3">
<a class="nav-link" href="#">Follow Us</a>
</li>
</ul>
</div>
<div class="card-body active" data-id="1">
<h5 class="card-title">(1) Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<div class="card-body hidden" data-id="2">
<h5 class="card-title">(2) Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<div class="card-body hidden" data-id="3">
<h5 class="card-title">(3) Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
,DataRange1d
和range_padding
字段计算填充边界,以及基础比例是线性还是对数。但它不存储计算值。
因此,此时您唯一的选择是为两个范围明确设置边界,或者根据前面提到的range_padding_units
字段和比例类型计算额外范围的边界。