我不明白为什么我的文字标题没有出现在我的绘图上。我发现文档中关于图例和标题标签的放置顺序非常混乱。
我的代码在这里,我不知道出了什么问题。除了标题的文本根本没有,一切都按我期望的显示(标题,轴标签,日期格式等)。
fig = plt.figure(figsize=(24, 12), dpi=60)
ax = fig.add_subplot(111)
plt.plot(datetime_series,ws_cumsum_mean1,label='1979-1994')
plt.plot(datetime_series,ws_cumsum_mean2,label='1996-2005')
plt.plot(datetime_series,ws_cumsum_mean3,label='2006-2014')
txt = '''Caption text'''
plt.legend(loc='best')
Run Code Online (Sandbox Code Playgroud)
这是我尝试添加标题的地方:
ax.text(0.5,-0.5,txt,transform=ax.transAxes)
Run Code Online (Sandbox Code Playgroud)
。
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%d-%m'))
plt.ylabel('Y label title')
plt.xlabel('X label title')
plt.title('Plot title')
Run Code Online (Sandbox Code Playgroud) 问候所有,
我编写了一个脚本来使用<figure>和从常规图像标签创建HTML5图像标题<figcaption>.
我的CMS使用FCKEditor,它总是将嵌入的图像放在段落中.所以我的脚本<figcaption>围绕图像构建,然后将其移到段落之外(参见html5,段落中的图/ figcaption给出不可预测的输出)).
我编写的脚本有效,但它遍历DOM两次,因为我无法找到一种只遍历DOM的方法.如果有精通JQuery的人能够就如何简化/改进脚本提供一些建议,我将不胜感激.
谢谢,-NorthK
// use like this:
// <img class="caption" src="http://placehold.it/350x150" alt="Sample image caption" />
//
$(document).ready(function() {
// iterate over each element with img.caption
$('img.caption').each(function() {
var classList = $(this).attr('class'); // grab the image's list of classes, if any
$(this).wrap('<figure class="' + classList + '"></figure>'); // wrap the <img> with <figure> and add the saved classes
$(this).after('<figcaption>' + $(this).attr('alt') + '</figcaption>'); // add the caption
$(this).removeAttr('class'); …Run Code Online (Sandbox Code Playgroud) 我有一些带有标题的图像。图像位于网站中央,标题应显示在图像下方。到目前为止非常简单,但问题是:标题应该左对齐并从图像的左下角下方开始(就像在报纸中一样)
我可以想到一个带有表格的解决方案,但我不喜欢它,因为表格在这里显示表格数据,而不是图像和图像标题
表解决方案:
<table class="centered-table">
<tr><td class="image"><img src="stackoverflow.jpg" /></td></tr>
<tr><td class="caption">Unanswered question on stackoverflow.com</td></tr>
</table>
Run Code Online (Sandbox Code Playgroud) 我有一个表格,其标题出现在表格顶部。
我需要另一个标题出现在表格底部。怎么可能呢?
<table>
<caption>My Table - Start</caption>
<tbody></tbody>
<tfooter></tfooter>
<caption>My Table - End</caption>
</table>
Run Code Online (Sandbox Code Playgroud) 当我尝试在RStudio中使用RMarkdown编织 pdf 时,此代码会产生错误。
如何在Fig.caption中写一个希腊字母,例如$\beta$?
---
title: "Untitled"
author: "SB"
date: "Thursday, January 29, 2015"
output:
pdf_document:
fig_caption: yes
---
```{r var, echo=FALSE, fig.cap="Cars variation rate between year $t$ and $t-1$ for $0 < \beta < 1$"}
plot(cars)
```
Run Code Online (Sandbox Code Playgroud) 我错过了在TinyMCE/Plone5中启用标题图像的功能.可以在控制面板中使用Plone4(https://plone.org/documentation/manual/plone-4-user-manual/using-tinymce-as-visual-editor/images)启用它.
现在我使用新的Plone5rc3和TinyMCE 1.4.3,但控制面板中的TinyMCE属性没有所需的复选框.
有人知道怎么做吗?非常感谢!
在我的长表中,当我使用横向模式时,标题与表格宽度不对齐。虽然当我删除横向模式时,它很好。然而,我的桌子又宽又长,我需要将其与横向模式对齐。这是一个 MWE,请帮帮我。
谢谢
\documentclass{article}
\usepackage{lipsum} % Just to fill some paragraph with random texts.
\usepackage[margin=1in,left=1.5in,includefoot]{geometry} % Setup the margin of the document \usepackage{float}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabu, colortbl}
\usepackage{array}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{lscape}
\usepackage[referable]{threeparttablex}
\usepackage{amsmath}
\usepackage{parskip}
\usepackage{xcolor}
\usepackage{setspace}
\renewcommand{\arraystretch}{1.5}
\setlength{\tabcolsep}{2pt}
\tabulinesep=1mm
\usepackage{ltcaption}
% The ltcaption package supports \CaptionLabelFont & \CaptionTextFont introduced by the NTG document classes
%\renewcommand\LTcaptype{table}
\renewcommand\CaptionLabelFont{\normalsize}
\renewcommand\CaptionTextFont{\normalsize}
\setlength{\LTcapwidth}{\textwidth} % caption width is same as table width
\setlength\LTcapskip{0.25em} % otherwise caption will skip baseline between caption and content
\renewcommand{\arraystretch}{1.5} % Insert …Run Code Online (Sandbox Code Playgroud) 我有一个与页面全宽的轮播。现在我需要将轮播标题设置为页面的整个宽度以及黄色背景。背景应该是页面的整个宽度,但实际的标题文本应该居中。
它应该是这样的:

这是现在的样子:

HTML:
<!--START CAROUSEL-->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="../../images/LD/desktop_hero1.png" alt="...">
<div class="carousel-caption">
Text for caption 1 here.
</div>
</div>
<div class="item">
<img src="../../images/LD/desktop_hero2.png" alt="...">
<div class="carousel-caption">
Text for caption 2 here.
</div>
</div>
<div class="item">
<img src="../../images/LD/desktop_hero3.png" alt="...">
<div class="carousel-caption">
Text for caption 3 here.
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a> …Run Code Online (Sandbox Code Playgroud) 我创建了一个带有指令的网格表:
..table:: *Table 1: Power Connector*
:align: center
Run Code Online (Sandbox Code Playgroud)
这是结果:
最大的问题是如何将标题“表 1:电源连接器”移动到表格下方,有什么技巧吗?我确信有,只是请不要深入研究 Sphinx 的源代码,给我一些简单的角色或可以做到这一点的东西(CSS 或其他东西),理想情况下,一个内置角色,如:align:
对于一款流行的文档软件来说,Sphinx确实缺乏很多高级的解释。:align:在对 Sphinx 本身的 python 源代码进行了一系列修改之前,我几乎没有找到该指令。拜托,Sphinx只是学习Python的借口吗?
在四开中,可以使用 并排显示图形和表格layout-ncol。理论上,我们应该能够使用cap-location: "bottom"将所有标题设置为底部,但这里并非如此。有没有办法将所有标题设置为底部,包括同时使用表格和图形时?
最小的例子:
---
title: "sidebyside"
format: pdf
editor: visual
---
```{r}
#| layout-ncol: 2
#| layout-valign: bottom
#| cap-location: bottom
#| fig-cap: "A plot"
#| tbl-cap: "A table"
library(knitr)
# plot on the left
plot(cars)
# table on the right
kable(head(cars))
```
Run Code Online (Sandbox Code Playgroud)
输出:
预期的输出将在底部有两个标题,并且没有额外的“A 图”。