鉴于以下条形图:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
df = pd.DataFrame({'A': ['A', 'B'], 'B': [1000,2000]})
fig, ax = plt.subplots(1, 1, figsize=(2, 2))
df.plot(kind='bar', x='A', y='B',
align='center', width=.5, edgecolor='none',
color='grey', ax=ax)
plt.xticks(rotation=25)
plt.show()
Run Code Online (Sandbox Code Playgroud)
我想将y-tick标签显示为数千美元,如下所示:
$ 2,000个
我知道我可以用它来添加一个美元符号:
import matplotlib.ticker as mtick
fmt = '$%.0f'
tick = mtick.FormatStrFormatter(fmt)
ax.yaxis.set_major_formatter(tick)
Run Code Online (Sandbox Code Playgroud)
...这是为了添加一个逗号:
ax.get_yaxis().set_major_formatter(
mtick.FuncFormatter(lambda x, p: format(int(x), ',')))
Run Code Online (Sandbox Code Playgroud)
......但是如何同时获得两者?
提前致谢!
我把这个CSS类给了一些输入字段
.searchField {
display: inline-block;
}
Run Code Online (Sandbox Code Playgroud)
这是他们的基础HTML ...
<div id="searchForm">
Search For Results<br>
<form id="search-form" action="/races/search" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="?">
<input type="text" name="first_name" id="first_name" placeholder="First Name" class="searchField">
<input type="text" name="last_name" id="last_name" placeholder="Last Name" class="searchField">
<input type="text" name="my_object" id="my_object" placeholder="Event" size="50" class="searchField">
<input alt="Search" type="image" src="/assets/magnifying-glass-0220f37269f90a370c3bb60229240f2a4e15b335cd42e64563ba65e4f22e4.png" class="search_button">
</form> </div>
Run Code Online (Sandbox Code Playgroud)
然而,尽管有足够的水平屏幕空间,其中一个仍然包装到下一行,正如这个小提琴所示 - https://jsfiddle.net/3mwn14fk/.如何将这些项目保留在一行(假设浏览器宽度足够)?注意我还想保持它们在垂直和水平居中的DIV.
编辑:这就是我在小提琴中看到的.这是在Firefox上.请注意,文本字段不在一行上.
编辑2
每个莫妮卡的小提琴,这就是我所看到的.请注意,第一个naem和姓氏在一行上,但事件文本框在下一行.我希望所有三个都在同一条线上,即使包含它们的黑盒必须扩展
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Display;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fm=getFragmentManager();
FragmentTransaction ft= fm.beginTransaction();
WindowManager wm= getWindowManager();
Display d=wm.getDefaultDisplay();
if (d.getWidth()>d.getHeight())
{
Fragment1 f1 = new Fragment1();
ft.replace(android.R.id.content, f1);
}
else
{
Fragment2 f2 = new Fragment2();
ft.replace(android.R.id.content, f2);
}
ft.commit();
}
}
Run Code Online (Sandbox Code Playgroud)
我试图使用Android的碎片和希望显示fragment1
在显示器的宽度大于显示器的高度和更大fragment2
时显示的高度比显示器的宽度,但使用时更大getWidth()
和getHeight()
机器人工作室是说,这些方法depricated。那么如何知道什么时候宽度更大,什么时候高度更大呢?
我正在使用mailchimp嵌入式注册表单.它显示电子邮件帐户,名字和姓氏,但验证码未显示.我从设置 - >列表名称和默认值启用了验证码.
我还需要采取哪些其他措施?Captcha未在预览模式选项中显示.
请帮忙,收到很多假电子邮件.双重选择也已启用.
需要截断管理列表显示中的文本
管理模型中有以下内容,但仍显示全文。
from django.template.defaultfilters import truncatewords
def get_description(self, obj):
return truncatewords(obj.description, 10)
get_description.short_description = "description"
class DieTaskAdmin(admin.ModelAdmin):
list_display =['severity','priority', 'subject', 'status','created',get_description.short_description']
admin.site.register(DieTask, DieTaskAdmin)
Run Code Online (Sandbox Code Playgroud)
即描述字段的原始文本包含超过255个字符。我喜欢只显示前 10 个字符加上...
我实际上正在开发一个网站.但我面临一个问题.我需要显示购物车中的商品数量,但只显示数字,没有别的我不想要总金额或其他任何东西.Juste的项目数量.
我的目标是在我的"去购物车"链接上显示它,这是一个带有href的图像.但这不是主要的pb.主要的pb是如何找到一种方法来获得购物车中的物品数量.
我正在使用安装了Avada的WordPress,以便能够自定义更多WP并获得一些包含功能.但我没有使用avada菜单,我正在使用自制菜单,我想在其中显示购物车中的商品数量.
对于"购物方",我正在使用WooCommerce.
我看到很多关于钩子的帖子和关于这个的一切,但它是关于"显示物品数量和总购物车数量,我不想显示总车量,我只想要数字.有点像这样:购物车数量: plein.com网站
我有一台4K显示器(3840 x 2160)和两台QHD显示器(2560 x 1440),我希望将它们并排放置.这当前是不可能的,因为这需要的水平虚拟分辨率是8960像素(3840 + 2560 + 2560),但是X服务器设置的最大(水平)虚拟分辨率是8192像素.有没有办法增加超过8192x8192像素的最大虚拟分辨率?
我到目前为止所做的尝试:
xorg.conf
文件 - 我尝试自己手动创建一个包括"Display"
子部分并"Virtual"
在那里设置不同的值,重新启动,没有任何改变.xrandr
使用--fb
和/或--panning
参数设置为所需最大值(8960x2160+0+0
)的各种命令变体,再次无济于事.(输出:xrandr: screen cannot be larger than 8192x8192 (desired size 8960x2160)
)我确实在某个地方读过一个声明(编辑: 这里),英特尔的图形处理器不支持比8192x8192像素更高的虚拟屏幕分辨率(我的系统使用Core i7-6700HQ
带Intel HD Graphics 530
图形处理器的CPU ),但遗憾的是我无法确认这些信息 - 希望如此不是这种情况.
编辑:事实上可能并非如此:
#: glxinfo -l | grep GL_MAX_TEXTURE_SIZE
GL_MAX_TEXTURE_SIZE = 16384
GL_MAX_TEXTURE_SIZE = 16384
Run Code Online (Sandbox Code Playgroud)
我的xrandr输出(我目前有第三个显示器位于右下角,因此8192x3600虚拟屏幕分辨率):
Screen 0: minimum 320 x 200, current 8192 x 3600, maximum …
Run Code Online (Sandbox Code Playgroud) multiple-monitors xorg screen-resolution external-display display
你好1我试图使用rdkit包来完成在Jupyter Notebook中显示分子原子数的工作,“import IPython.core.interactiveshell”和“import InteractiveShell”,以及“from rdkit.Chem.Draw import DrawingOptions”包,然后我使用“DrawingOptions.includeAtomNumbers=True”来处理它,但结果根本不显示原子索引。不知道是什么原因导致原子数没有显示。所以我想请您给出一个合适的答案。多谢!
在我的场景中,我想在我的应用程序中镜像另一个应用程序。
我DisplayManager
用来createVirtualDisplay
为我的SurfaceView
. 然后我在开始活动时设置DisplayId
为这个。VirtualDisplay
AcitivityOptions
通过这个过程,另一个应用程序可以在我的表面视图中成功启动。但是有一些显示问题。根据我的测试,只有图像、背景颜色和GLSurfaceView.Renderer
渲染正确。诸如TextView
和 之类的 ui 组件Button
不会在SurfaceView
.
从上面的测试结果来看,我猜测可能与渲染的深度或顺序有关。
示例代码如下:
SurfaceView surfaceView = findViewById(R.id.surface_view);
int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION |
DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC |
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR;
DisplayManager displayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE);
VirtualDisplay virtualDisplay = displayManager.createVirtualDisplay("MyVirtualDisplay",
surfaceView.getWidth(), surfaceView.getHeight(), 1, surfaceView.getHolder().getSurface(),
flags);
int displayId = virtualDisplay.getDisplay().getDisplayId();
ActivityOptions options = ActivityOptions.makeBasic().setLaunchDisplayId(displayId);
Intent intent = getPackageManager().getLaunchIntentForPackage(appName);
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent, options.toBundle());
Run Code Online (Sandbox Code Playgroud)
相比之下,如果我将相同的活动镜像到一个Display
而不是VirtualDisplay
,则可以由MediaRouter
或捕获DisplayManager
。这样,一切都正确显示(在我的测试中,我通过“开发人员选项”->“模拟辅助显示器”模拟第二台显示器):
MediaRouter …
Run Code Online (Sandbox Code Playgroud) 太长了;博士
在 Windows 10 下,如果我将辅助显示器放在主显示器的右侧,并对辅助显示器应用缩放(例如 150%),则显示坐标(由 Java API 返回)会重叠,而不是让显示边界并排坐着。换句话说,如果我慢慢地将鼠标从主屏幕的左边缘移动到辅助屏幕的右边缘,Java的APIMouseInfo.getPointerInfo().getLocation()
会返回从0到1920递增的X位置,然后一旦光标进入第二屏幕,该值就会跳跃返回到 1280,然后再次增加到 2560。因此,对于不同的区域,1280-1920 范围会返回两次。
在帖子的末尾,我添加了一个(更新的)演示,使问题变得显而易见。不要犹豫,尝试一下并报告回来。
长版本:
这篇文章提供了太多的背景信息,但也旨在分享我在搜索该主题时学到的东西。
首先,为什么要麻烦?因为我正在用 Java 构建一个屏幕捕获应用程序,该应用程序需要正确处理多显示器配置,包括应用 Windows 缩放功能的显示器。
使用 Java API ( GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()
),只要缩放为 100%,就可以观察到主显示器的左上角位于原点 (0,0),而其他显示器的坐标位于主显示器的“旁边” 。
以下图片是使用帖子末尾的代码制作的。
例如,如果我们有 2 个全高清显示器,则主显示器的左上角位于 (0,0),而...
然而,如果辅助显示器被缩放,事情就会出错:似乎缩放因子不仅应用于其尺寸,还应用于其原点,它越来越接近 (0,0)。
如果次级在左边,那就有意义了。例如,当辅助 1920x1080 缩放为 150% 时,它会使逻辑 1280x720 定位在 (-1280,0):
但如果辅助坐标位于右侧,则原点也会缩放到 (1280,0),越来越接近原点并导致它“重叠”主要坐标:
换句话说,如果鼠标位于 (1800,0) - 请参阅上面的红点 - 我无法知道它实际上是位于第一个显示器的右侧(距右边缘 120 像素)还是左侧第二个的(在左边缘的 520 像素处)。在这种情况下,当将鼠标从主显示器移动到辅助显示器时,鼠标的 X 位置会在到达主显示器的边框时“跳回”。
在屏幕上定位窗口也是如此。如果我将对话框的 X 位置设置为 1800,我无法知道它将在哪里打开。
经过多次浏览后,像这样的 …
display ×10
android ×2
admin ×1
api ×1
awt ×1
block ×1
cart ×1
comma ×1
css ×1
django ×1
dollar-sign ×1
email ×1
fragment ×1
html ×1
inline ×1
java ×1
jna ×1
list ×1
mailchimp ×1
matplotlib ×1
moleculer ×1
numbers ×1
php ×1
python-3.x ×1
rdkit ×1
recaptcha ×1
windows ×1
woocommerce ×1
wordpress ×1
xorg ×1